$x = 4 ; function assignx ( ) { $x = 0 ; print "\$x inside function is $x . " ; } assignx ( ) ; print "\$x outside of function is $x . " ; 代码的执行结果为: $x inside function is 0 . $x outside function is 4 .
输出所有预定义变量: foreach ( $_SERVER as $var => $value ) { echo "$var => $value " ; } 显示用户的IP地址: print "HI!Your IP address is ".$_SERVER[ ' REMOTE_ADDR' ] ;
PHP中要使用预定义变量数组,必须在PHP.INI文件中启用配置参数 track_vars 。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn