开发者

"Syntax error, unexpected T_STRING" problem with goto [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

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 question

http://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

开发者_StackOverflow

It 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜