0

Hi all I am trying to call a simple function and I keep getting an error
"Parse error: syntax error, unexpected ';', expecting '{' in C:\wamp\www\david\remoteaccess\index.php on line 15"
This relates to the call and I don't understand why it does not work. I am using WAMP if that makes any difference.

Thanks in advance

David
`

<?php
//session_start();
//include("includes/utilities.php");
//$Errors = "";
//  $_SESSION['LoggedIn'] = false;
//  $_SESSION['UserID'] = "";
//  $_SESSION['UserAdmin'] = false;

function hello() {
    print "<h1>HELLO!</h1>";
    print "<p>Welcome to my web site</p>";
}


function hello();
?>

`

4
Contributors
4
Replies
14
Views
3 Years
Discussion Span
Last Post by davidjennings
0

This might help:

<?php
//session_start();
//include("includes/utilities.php");
//$Errors = "";
//  $_SESSION['LoggedIn'] = false;
//  $_SESSION['UserID'] = "";
//  $_SESSION['UserAdmin'] = false;
$func = function hello() {
    print "<h1>HELLO!</h1>";
    print "<p>Welcome to my web site</p>";
}
echo $func
?>
0

This relates to the call and I don't understand why it does not work.

To call the function, you need to omit function. That's only used when defining the function.

0
<?php

function hello() {
    print "<h1>HELLO!</h1>";
    print "<p>Welcome to my web site</p>";
}


hello();
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.