Bas Jobsen wrote:
> Hi,
>
> I want to use a ?: statement. If not true de default function
> argument have to be used. How to do this
>
> <?
> function test($test='default')
> {
> echo $test;
> }
> test(($value==1)?'no default':null);
>>
>
> What do i have to pass instead of null to get default print?
Try this:
function test($test = null) {
if (is_null($test)) { $test = 'default'; }
echo $test;
}
test(($value == 1) ? 'no default' : null);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php