we create a function check_s now and it as default values, if the value is not written down then it will give the default values to strings and we have if statment to check if the string is empty then display the default value of the argument.
code:
function check_s($arg1 = 'no', $arg2 = 'argument 2', $arg3 = 'nas'){
return $arg1.$arg2.$arg3;
}
if( $s == 0 )
$foo[0] = ' localhost ';
if( $i == 0 )
$foo[1] = ' arg2 here ';
if( $i == 0 )
$foo[2] = ''; // call default value here
$stuff = implode( ",", $foo );
echo check_s($stuff);
ouput:
localhost,arg2 here,argument 2nas
it should display this outout:
localhost arg2 here nas
so if you can c is not working any idea how to make it work?