Garethp Posted August 18, 2009 Share Posted August 18, 2009 I'm just starting to make classes, and when I learned a bit of Python I learned that you could pass arguements that had to be called specifically like dosomefunction(value1='', value3='', value2='') So it didn't matter what order you put them in. Can you do something similar in PHP? Link to comment https://forums.phpfreaks.com/topic/170777-solved-php-arguments/ Share on other sites More sharing options...
HoTDaWg Posted August 18, 2009 Share Posted August 18, 2009 <?php function MyFunction($thevariable){ global $variable2; echo $thevariable . '<br>'; echo $variable2; } $variable2 = 'this value is global.'; MyFunction('hi'); ?> hope this gets ya started bud. Link to comment https://forums.phpfreaks.com/topic/170777-solved-php-arguments/#findComment-900658 Share on other sites More sharing options...
trq Posted August 18, 2009 Share Posted August 18, 2009 Nope. The closest would be to pass an array. eg; functionname (array('b'=>'foo','a'=>'bar')); Then handle that within your function. Link to comment https://forums.phpfreaks.com/topic/170777-solved-php-arguments/#findComment-900660 Share on other sites More sharing options...
Garethp Posted August 18, 2009 Author Share Posted August 18, 2009 Thanks thorp Link to comment https://forums.phpfreaks.com/topic/170777-solved-php-arguments/#findComment-900661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.