Help im stuck i dont know whats wrong with my code


Parameters and Arguments

i dont know what to do helpppppp! ive tried everything and nothing works. i dont know what =s wrong with my code


function greetings ($name)
echo "Greetings, " . $name . "!";



Invalid HTML, might be the problem. The ENDTAG is missing an OPENTAG, so your markup is closing an element that is not open.

Aside: Since this is only an introduction, and basically a scratch on a scratch, a lot of the finer details are omitted. Your echo statement could be written with single quotes,

echo 'Greetings, ' . $name . '!';

which would be the norm. When using double quotes, it is likely more typical to see string interpolation...

    echo "Greetings, $name!";

This will only work with double quotes, and as we can see is a lot more readable. PHP recognizes the variable embedded in the string.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.