wdseelig Posted December 7, 2014 Share Posted December 7, 2014 I am looking at the following code snippet: functioncall(array(),$variable) I've looked everywhere, but cannot find what this is supposed to mean. In the function that is called I see function functioncall($var = array(), $var1 = array()) Is this some kind of cast?? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/292953-array-construct/ Share on other sites More sharing options...
WinstonLA Posted December 7, 2014 Share Posted December 7, 2014 I don't understand what problem? Did you never see default parameters for functions? Quote Link to comment https://forums.phpfreaks.com/topic/292953-array-construct/#findComment-1498884 Share on other sites More sharing options...
wdseelig Posted December 7, 2014 Author Share Posted December 7, 2014 of course I've seen default parameters, but that is not what the call to the function looks like [there is no = sign]. Does the (array(),$variable) construct mean that the function is being called with an array with a default value of $variable? Quote Link to comment https://forums.phpfreaks.com/topic/292953-array-construct/#findComment-1498885 Share on other sites More sharing options...
wdseelig Posted December 7, 2014 Author Share Posted December 7, 2014 Or does it mean that functioncall is being called with two variables, the first of type array() and the second with value $variable? Quote Link to comment https://forums.phpfreaks.com/topic/292953-array-construct/#findComment-1498886 Share on other sites More sharing options...
Solution Barand Posted December 7, 2014 Solution Share Posted December 7, 2014 functioncall(array(),$variable) is calling the function and passing two parameters. The first is an empty array, the second is whatever is in $variable. No different from $a = array(); $b = array(1,2,3); functioncall ($a, $b); Quote Link to comment https://forums.phpfreaks.com/topic/292953-array-construct/#findComment-1498887 Share on other sites More sharing options...
wdseelig Posted December 7, 2014 Author Share Posted December 7, 2014 Thank you guru!! Quote Link to comment https://forums.phpfreaks.com/topic/292953-array-construct/#findComment-1498889 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.