views:

31

answers:

3

Hello, can I use this syntax under PHP 4 (default function parameter) :

function myFunction($arg1 = 'defaultValue') {}

Thanks.

+1  A: 

Yes you definitely can do.

Hope it helps.

Knowledge Craving
+1  A: 

why don't you simply try it? yes, you can.

oezi
+1 try it yourself :)
Tim
I use php 5 on my dev machine but I want my code to be compatible with php 4 too...
Fabien Bernede
+4  A: 

Yes you can. And it can be overwritten like this:

<?php
$var = 'one';
myFunction($var);

function myFunction($arg1 = 'defaultValue') {
echo $arg1;
}
?>

the output would be one

Ruel