I am using drupal 4.7x.
I write the following code in the blog entry
<?php
$life=42;
function meaningOfLife() {
global $life;
print "The meaning of life is $life<br />";
}
meaningOfLife();
?>
and then select php code as input format.
The result turn out to be
The meaning of life is
which is wrong, apparently, what i want is
The meaning of life is 42.
This is an example given in php.net so it should be correct. Moreover since the function is executed, it confirms I installed php. However I can't define the variable $life in the function. It is printing the text, so it is calling the function however it is not calling the variable. Can anyone tell me what went wrong?