Php5.4.0

Source: Internet
Author: User
Tags parse error
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 the previous version (php5.2) is still used)
For example, there are two minor issues:

1. php5.4.0 namespace problems:
 

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:
$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!


Reply to discussion (solution)

There is another problem.
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'libmcrypt. dll 'in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '../PHP/ext \ php_iconv.dll'-contains invalid paths
In Unknown on line 0

How can this be solved? You can call php.exe to debug the output in ue, but it is normal to use .... Very depressing. Why does DOS report an error ....
(Note: In my own mobile configuration, an error was reported before. put libmcrypt. dll and php_iconv.dll in the/Windows directory for use. now, an error is reported, which is depressing ....)

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?

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:

//Short array syntax$a=[1,2,3,4,5,6];//Array dereferencingfunction foo(){ return array(1,2,3,4);}echo foo()[1];


There are also Buid-in web server and Traits.

Validation Question 1: it is indeed a BOM header issue for the UTF-8, resolved:
UE to save the use of the format for the UTF-8 without BOM, get!
Extended Question 2: Can the quotation marks be removed correctly ??

I also encountered problem 1, but I wrote '# in the first line '#! /Bin/env php'
It is difficult to explain the language change in just a few words. you 'd better check the document.
The following are my changes to php from 5.3 to 5.4.
Http://www.php.net/manual/zh/migration54.php

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.