Php reports syntaxerror, unexpectedT_GOTO, and expectingT_STRING errors. the error file and the number of lines point to the above code. why?

Source: Internet
Author: User
Php reports syntaxerror, unexpectedT_GOTO, and expectingT_STRING errors. the error file and number of lines point to the following code. why? The php version of this machine is 5.3.8, Apache/2.2.21. I guess it is an environment problem because it was originally running normally. how can I solve this problem when I put it on another computer? Php reports syntax error, unexpected T_GOTO, expecting T_STRING. the error file and number of lines point to the following code. why?
The php version of this machine is 5.3.8, Apache/2.2.21. I guess it is an environment problem because it was originally running normally, but this problem occurs on another computer.
How can this problem be solved? Sorrow!

Public function goto ($ url, $ msg = NULL ){
If ($ msg ){
$ This-> jsAlert ($ msg );
}
$ This-> js ('document. location = "'. $ url .'";');
$ This-> output (true );
Exit;
}

------ Solution --------------------
From php5.3, php restored the goto commands abandoned by structured programming for years.
Since goto is upgraded to a reserved word, you cannot use it as a function (method) name.

The goto operator can be used to jump to a specified position in the program. You can add a colon to the target location. PHP has certain restrictions on goto. you can only jump to the same file and scope. that is to say, you cannot jump out of one function or class method, or jump to another function. You cannot jump into any loop or switch structure. A common usage is to jump out of a loop or switch, which can replace multiple levels of break.

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.