I have this situation:
Code: Select all
function( $param1, $param2 );
$param2 = 'abcd';Regards,
Marush Denchev
Moderator: General Moderators
Code: Select all
function( $param1, $param2 );
$param2 = 'abcd';Not really no, if you're calling a function at a specific point in the flow of logic then it will only use the variables available at that time. Re-think your logic, or re-call the function if the value changes. This is where careful planning pays offantubis wrote:Hello,
I have this situation:
$param2 is assigned later ( it can be assign before ) but function should use it. Is there any way PHP to check script till the end and if the varible exists to use it.Code: Select all
function( $param1, $param2 ); $param2 = 'abcd';
Regards,
Marush Denchev
Code: Select all
function( $param1, $param2='abcd')
{
...
}Code: Select all
function( $param1,$param2='xqz',$param3, $param4='abcd')
{
...
}Code: Select all
function( $param1,$param3,$param2='xyz', $param4='abcd')
{
...
}