Php5.4.0 has just updated php5.4.0 in the evening. The environment is Windows 7 + Apache2.2 + MySQL5.1 + PHP5.4.0, php. ini has not been updated, and it still uses the previous version (php5.2). There are two minor problems: 1. the namespace problem of php5.4.0: PHPcode & lt ;? PhpnamespaceFoo; classtest {small issues with php5.4.0
Php5.4.0 was updated in the evening. The environment is Windows 7 + Apache2.2 + MySQL5.1 + PHP5.4.0. php. ini is not updated and the previous version (php5.2) is still used)
For example, there are two minor issues:
1. php5.4.0 namespace problems:
PHP code
Appears:
Fatal error: Namespace declaration statement has to be the very first statement in the script in F: \ htdocs \ rules. php on line 2
What's the problem ??? It is useless to declare .... An error occurred while directly copying the manual code .... Is it php5.4's own error or my configuration problem ??
2. paste the code directly:
PHP code
$phpinfo = function (){ echo 'hello world!'; } phpinfo(); $phpinfo();
Error Code: Parse error: syntax error, unexpected 'phpinfo' (T_STRING)
I think this is not a problem. I just want to know why it is. if you directly rewrite the OverWrite method, a fatal error will be generated directly in the letter declaration, but it can be executed normally, and the php built-in method is overwritten directly (although it cannot be output normally ), this should not only be included in 5.4. I believe it will also exist in other versions. Is it a Bug ?? Thank you.
In addition, can you tell me some features of version 5.4 ??
I haven't knocked on php for a long time. I'm a little unfamiliar, let alone I 've learned about the new features of php ....
Thanks again!
------ Solution --------------------
1. the error message is clear. it is estimated that your program has a BOM header. 2. this is to assign a value to $ phpinfo, so you must add a semicolon at the end of the line to close it correctly.
3. the error message shows you the path, right?
------ Solution --------------------
The first problem should be the bom header.
The second is to define $ phpinfo as an anonymous function. it has no relationship with phpinfo () and does not overwrite phpinfo (). it is normal to add ';' after it.
New features support the following syntax:
PHP code
//Short array syntax$a=[1,2,3,4,5,6];//Array dereferencingfunction foo(){ return array(1,2,3,4);}echo foo()[1];