This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this questionhttp://www.faressoft.org/test/hello.php
My Code :
<?php
echo "hello World";
goto end; // this is line 3
echo "before end";
end:
echo "end";
?>
Error : Parse error: syntax error, unexpected T_STRING in /home/alfalah1/public_html/faressoft.org/test/hello.php on line 3
开发者_StackOverflowIt works very well in my localhost but doesn't work in justhost server ? why ?
but doesn't work in justhost server ? why ?
Probably because the remote server isn't running PHP 5.3, which is the minimum required version for goto
.
That said, using the goto
keyword is generally regarded as an awfully, awfully bad practice from the olden days. I still think this got introduced in PHP because of a lost bet or something. I would not get into the habit of using it.
精彩评论