haku Posted April 3, 2009 Share Posted April 3, 2009 Look at this code: <?php $node = $form_state['node'] + (array)$node; } ?> I'm curious about it, as I have never seen code like this. First, how does the plus sign work in PHP? And what is (array)$node? This is new to me as well. Can anyone enlighten me? Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 3, 2009 Share Posted April 3, 2009 (array)$node cast $node variable to an array (basically makes sure it's an array) http://www.php.net/language.types.type-juggling How is it supposed to work with + however? Strange... Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 3, 2009 Share Posted April 3, 2009 Presumably $form_state['node'] is an array, in which case - $a + $b Union of $a and $b. ... The + operator appends elements of remaining keys from the right handed array to the left handed, whereas duplicated keys are NOT overwritten. Quote Link to comment Share on other sites More sharing options...
haku Posted April 6, 2009 Author Share Posted April 6, 2009 Thanks guys, that answers my questions, and I see how it all works now. Quote Link to comment 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.