Home >>PHP Object Oriented >Php Parameterized Functions

Php Parameterized Functions

Php Parameterized Functions

<?php 
function printName($x)
{
	if(is_numeric($x))
	{
	return 1;
	}
	else
	{
	return $x;
	}

}

$ret=printName("abc");

if($ret==1)
{
echo "<p style='color:red'>Name must be string</p>";
}
else
{
echo "<p style='color:blue'>Welcome ".$ret."</p>";
}


?>

No Sidebar ads