I have been able to write functions but cannot get them to work. Many sites show you how to write them but not how to call them in your web programming.
Can someone explain why this call does not work for me ?
the function is:
<? php
function fix_name($name)
{
$name= ucwords(strtolower($name));
return $name;
}
?>
If I do this:
<? php
require_once "fix_name.php";
echo ("costa playa");
?>
IT does not work
But, if I enter this
<?php
echo fix_name("costa playa");
function fix_name($name)
{
$name= ucwords(strtolower($name));
return $name;
}
?>
IT works.
It is very basic,I know but I am struggling.