PHP error syntax error, unexpected T_goto, expecting t_string, error file and line number pointing to the above code, what is the reason

Source: Internet
Author: User
Tags php error
PHP error syntax error, unexpected T_goto, expecting t_string, error file and line number point to the following code, what is the reason?
Native PHP version is 5.3.8,apache/2.2.21, I guess is the environmental problem, because it is normal operation, is put on another computer when the problem occurs
How to solve it? Worry Ah!

Public Function goto ($url, $msg =null) {
if ($msg) {
$this->jsalert ($msg);
}
$this->js (' document.location= '. $url. '";');
$this->output (TRUE);
Exit
}

------Solution--------------------
Starting with php5.3 PHP restores goto instructions discarded by structured programming over the years
Now that Goto has been upgraded to a reserved word, you can't use it as a function (method) name

The goto operator can be used to jump to a specified location in a program. The target location can be tagged with the target name plus a colon. The Goto in PHP has a certain limit and can only jump in the same file and scope, meaning you can't jump out of a function or class method, or jump into another function. You can't jump into any loop or switch structure either. A common use is to jump out of a loop or switch, instead of a multi-layered 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.