Some small problems with php5.4.0

Source: Internet
Author: User
The evening has just updated php5.4.0, the environment is WINDOWS7 + Apache2.2 + MySQL5.1 + Php5.4.0,php.ini no re-update, still using the previous version (php5.2)
Title, there are two minor problems:

1,php5.4.0 namespace-space issues:
 
  

Appear:
Fatal Error:namespace declaration statement have to is the very first statement in the script in F:\htdocs\rules.php on Li NE 2
What's the problem??? How to declare it is useless .... The code for the direct copy of the manual also went wrong .... Is php5.4 own mistake or I configure the problem??

2, directly paste code it:
$phpinfo = function () {echo ' Hello world! ';} Phpinfo (); $phpinfo ();


Error code: Parse error:syntax Error, unexpected ' phpinfo ' (t_string)
I don't think that's a problem. Just want to know why it is so. If the direct overwrite will produce a fatal error directly in the letter declaration, but here can execute normally, and directly overwrite the PHP built-in method (although not normal output), this should not only be in 5.4, I believe in other versions of the same, is a bug?? Thank you
Besides, can you give me some features of version 5.4?
A long time did not knock PHP, are a little rusty, let alone to understand the new features of PHP ....
Thanks again!


Reply to discussion (solution)

There is one more 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 does this work? Call Php.exe debug output in UE, but normal use no problem .... Very depressed, dos why the error ....
(Note: My own configuration of the mobile configuration, before the error, put Libmcrypt.dll and php_iconv.dll into the/windows directory available, now but also error, depressed ....) )

1. The error message is clear, it is estimated that your program has a BOM header. 2. This is to assign a value to the $phpinfo, so the end of the line with a semicolon to properly close.
3. Error hints give you the path you see right

The first one should be the BOM header problem
The second one just defines $phpinfo is an anonymous function, and phpinfo () does not have a half-dime relationship, and does not cover the phpinfo (), followed by '; ' is normal.
The new feature supports 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];


and buid-in Web server and traits downstairs to add

Confirm question one: it is indeed the UTF-8 BOM header problem that has been resolved:
UE Save with Format UTF-8 no BOM, done!
Extension problem two: after the quotation mark removal can be called correctly, but why do not add quotation marks without error??

I also ran into a problem, but mine was because the first line wrote ' #! /bin/env php '
Language changes are difficult to few words, you'd better check the documentation.
Here's what I checked for PHP changes 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.