I’m trying to get some PHP example code to work on PHP version 5.3.4, Apache 2.2.17 on Windows.
The example says I need PHP 4.0 and above with CURL and contains:
<?
$function = $_GET['function-if-exist'];
$test = "Test";
?>
<? =$test ?>
I don’t understand why I’m getting the following errors:
- My PHP doesn’t understand <? and wants <?PHP instead.
- My PHP doesn’t like <? =$test ?> and wants something like
<?PHP echo $test ?> - $function = $_GET[‘function-if-exist’]; causes the error “Undefined index” but presumably works for the folks that developed it.
Can anyone help me understand why their code is not working for me?
1)
<?is the “short tag”. Most servers are configured to not allow short tags. This can be changed inphp.ini.2) Again, short tags. Also I think you can’t have a space before the
=, but the main problem is the short tags setting.3)
$_GETaccesses the query string, so when loading your script you needmyscript.php?function-if-exist=something