- function pureencode($str) {
- $ret = "";
- for($i=0; $i<strlen($str); $i++) {
- $ret .= "%" . dechex(ord($str[$i]));
- }
- return $ret;
- }
- echo pureencode(‘abcdef’);
- print_r($_GET);
- ?>
国外的PHP程序员面试题目一解
一朋友说是国外的PHP程序员面试题目,解之:
题目三:
Create a class, Test3, with the following behavior:
The class must take a string of the format
name1=value1:name2=value2:name3=value3 consisting of name and value
pairs, separated by the : symbol. I must be able to enter as many
pairs as I like when I call the class, the only limit is that each
pair is formated as name=value and multiple pairs are separated by
the : symbol.
When an object of the class is created it must end up with a variable
for each name=value pair. The name of the variable must be the same
as the name part of the substring and the value of the variable must
be the same as the value part of the substring. For example:
creating an object with new Test3(“firstname=david:lastname=smith”)
must create variables within the class:
$firstname = “david”;
$lastname = “smith”;
and new Test3(“food1=pasta:food2=chocolate”) must create variables
within the class:
$food1 = “pasta”;
$food2 = “chocolate”;
I should be able to use any variable names and values provided they
do not include the symbols : or =
You should then write a function print_all that will print the all
the names of the defined variables in the class along with their
values in the following format:
Variable 1 – Name = (whatever the actual name is), Value = (whatever
the actual value is)
Variable 2 – Name = (whatever the actual name is), Value = (whatever
the actual value is)
Variable 3 – Name = (whatever the actual name is), Value = (whatever
the actual value is)
and so on until all the variables are listed.
The last line of output of the print_all function should be the words
“The original input was “ followed by a string that is an exact
representation of the string parameter supplied when creating the
class object.
For example, if you did new Test3(“firstname=david:lastname=smith”)
then the print_all function should output:
Variable 1 – Name = firstname, Value = david
Variable 2 – Name = lastname, Value = smith
The original imput was (“firstname=david:lastname=smith”)
This must work for any input string that has the correct format and
you may not store the complete input string or directly output it to
produce the last line of the print_all function output as that would
be too easy.
- class Test3 {
- private $keys = array();
- function __construct($args) {
- $this->Test3($args);
- }
- function Test3($args) {
- $arr = explode(":", $args);
- foreach($arr as $v) {
- $varr = explode("=", $v);
- $key = $varr[0];
- $value = $varr[1];
- $this->$key = $value;
- array_push($this->keys, $key);
- }
- }
- function print_all() {
- $ret = array();
- foreach($this->keys as $key) {
- array_push($ret, $key."=".$this->$key);
- }
- return implode(":", $ret);
- }
- }
- $t = new Test3("name=seaprince:name2=renothing");
- print_r($t);
- print $t->print_all();
- ?>
JSA在线压缩工具
转jindw: http://www.javaeye.com/topic/115300
JSA在线压缩工具,是java编写的,需要安装java运行环境。
这多少给一些非jav程序员带来点不便。
现在我们发布servlet在线压缩版本。无需安装,在线压缩,给非Java用户一个更加便捷的使用方式。
项目主页:http://www.xidea.org/project/jsa/
现在的在线压缩服务器由Seaprince提供。
欢迎更多有空闲服务器资源的朋友安装JSA在线服务,我将在jsa项目主页提供链接,方便大家使用。
仍外,为了避免服务器资源被恶意滥用,我们默认启用了图片验证,服务频率限制等保护设置。
给用户带来些不便,敬请谅解。
在本站的镜像地址为:http://jsa.eaxi.com
18+成人寓言,流氓的泡妞哲学
①蛇与乌龟的故事
一条大蟒蛇和一条小毒蛇是朋友。
这天他们在路边发现了一只巨大的乌龟。
蛇兄弟想,这么大的个儿,可是一顿美餐啊。
蟒蛇说:我来对付他。
中国惠普前总裁孙振耀谈工作与生活
我有个有趣的观察,外企公司多的是25-35岁的白领,40岁以上的员工很少,二三十岁的外企员工是意气风发的,但外企公司40岁附近的经理人是很尴尬的。我见过的40岁附近的外企经理人大多在一直跳槽,最后大多跳到民企,比方说,唐骏。外企员工的成功很大程度上是公司的成功,并非个人的成功,西门子的确比国美大,但并不代表西门子中国经理比国美的老板强,甚至可以说差得很远。而进外企的人往往并不能很早理解这一点,把自己的成功90%归功于自己的能力,实际上,外企公司随便换个中国区总经理并不会给业绩带来什么了不起的影响。好了问题来了,当这些经理人40多岁了,他们的薪资要求变得很高,而他们的才能其实又不是那么出众,作为外企公司的老板,你会怎么选择?有的是只要不高薪水的,要出位的精明强干精力冲沛的年轻人,有的是,为什么还要用你?
个性化你的Apache
今天晚上把Apache2.2.4编译了一遍又一遍,颇有味道。若有同好者,请看此文。
王通和admin5的SEO讲课内容
大家要学习SEO,首先就要把SEO看的简单一点,其实SEO真的没有大家想象的那么复杂,不过你看了很多SEO资料后,你学习的不好
。主要是因为几个原因:
1、不认真,太多细节没有注意到
2、实践少,没有多多实践和总结
因为今天群的朋友基础不一样,所以我从最基础开始讲
SEO是Search Engine Optimization的缩写,即“搜索引擎优化”。而从事这方面工作的就是Search Engine Optimizer,即“搜索
引擎优化师”。
SEO是专门研究各大搜索引擎排名的技术,是数百种低成本网站推广策略中最常用和长期有效的营销手段之一。
既然是研究各大搜索引擎排名的技术,我们要考虑的第一个问题就是:
全球的搜索引擎都喜欢把什么样的网站,放到搜索结果的自然排名前面
答案非常简单: 肯定是优秀的网站!
那么,什么样的网站才是优秀的网站呢?
1、内容是用户需要的内容
2、网站的各方面设计细节要符合搜索引擎的标准?