摘要: string mb_detect_encoding ( string $str [, mixed $encoding_list = mb_detect_order() [, bool $strict = false ]] ) //Converts the character encoding of string str to to_encoding from optionally from_encoding. string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_enc... 阅读全文
posted @ 2013-01-17 15:16 可不可以 阅读(392) 评论(0) 推荐(0)
摘要: void unset ( mixed $var [, mixed $var [, $... ]] ) unset() 销毁指定的变量。注意在 PHP 3 中,unset() 将返回 TRUE(实际上是整型值 1),而在 PHP 4 中,unset() 不再是一个真正的函数:它现在是一个语句。这样就没有了返回值,试图获取 unset() 的返回值将导致解析错误。 unset()用于全局变量示例:<?php//销毁单个变量unset($foo);//销毁单个数组元素unset($bar['quux']);//销毁一个以上的变量unset($foo1,$foo2,$foo3); 阅读全文
posted @ 2012-10-11 14:33 可不可以 阅读(209) 评论(0) 推荐(0)
摘要: 变量的范围即它定义的上下文背景(也就是它生效的范围)。大部分的 PHP 变量只有一个单独的范围。这个单独的范围跨度同样包含了 include 和 require 引入的文件。例如:<?php$a=1;include'b.inc';?> 这里变量 $a 将会在包含文件 b.inc 中生效。但是,在用户自定义函数中,一个局部函数范围将被引入。任何用于函数内部的变量按缺省情况将被限制在局部函数范围内,此时为局部变量。 PHP 中全局变量在函数中使用时必须申明为global。 在函数中使用global声明的变量即为全局变量,可以在函数外使用。注意:global声明变量时,不 阅读全文
posted @ 2012-10-11 12:04 可不可以 阅读(472) 评论(0) 推荐(0)