goto的"语法错误,意外的T_STRING"问题

far*_*oft 3 php string syntax goto

http://www.faressoft.org/test/hello.php

我的代码:

<?php
echo "hello World";
goto end; // this is line 3
echo "before end";
end:
echo "end";
?>
Run Code Online (Sandbox Code Playgroud)

错误:解析错误:语法错误,第3行/home/alfalah1/public_html/faressoft.org/test/hello.php中的意外T_STRING

它在我的localhost中工作得很好,但在justhost服务器上不起作用?为什么?

Pek*_*ica 9

但是在justhost服务器中不起作用?为什么?

大概是因为远程服务器没有运行PHP 5.3,这是需要的最低版本goto.

也就是说,使用goto关键字通常被认为是过去非常糟糕的做法.我仍然认为这是因为丢失赌注或其他东西而在PHP中引入的.我不会养成使用它的习惯.