hkguile
hkguile

Reputation: 4369

old function don't work in php 5.35

function goto($herf) {
    echo ("<script>window.location.href='".$herf."'</script>");
}

the above function work well before php 5.3.5, after i upgrade my php to 5.3.5, the following error displayed.

Parse error: syntax error, unexpected T_GOTO, expecting T_STRING or '(' in C:\xampp\htdocs\directory\directory\directory\directory\file.php on line 9

what is that error refer?

Upvotes: 0

Views: 576

Answers (2)

enobrev
enobrev

Reputation: 22542

They added goto to the php language, which makes it a reserved word and no longer available as a function name.

The goto operator is available as of PHP 5.3.

Upvotes: 8

Lucas
Lucas

Reputation: 3715

So solution is:

function location($herf) {
    echo ("<script>window.location.href='".$herf."'</script>");
}

Upvotes: 2

Related Questions