GD77 Posted December 5, 2012 Share Posted December 5, 2012 Hello: Any suggestions how to use all variables of a methods inside an array to apply another method on each one? fuction fn0(){....}//end fn0 function fn1($x1,$x2,$x3,$x4){ $mAr=array($x1,$x2,$x3,$x4); foreach($mAr as $val){ $this->fn0($val); }//end foreach }//end fn1 In reality I have like $x12. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/271629-methods-variables/ Share on other sites More sharing options...
Christian F. Posted December 5, 2012 Share Posted December 5, 2012 Why not send an array in the first place, and why are you doing this? Quote Link to comment https://forums.phpfreaks.com/topic/271629-methods-variables/#findComment-1397672 Share on other sites More sharing options...
GD77 Posted December 5, 2012 Author Share Posted December 5, 2012 (edited) need to apply many conditions from the fn0 to each variable but trying to avoid doing so manually Edited December 5, 2012 by GD77 Quote Link to comment https://forums.phpfreaks.com/topic/271629-methods-variables/#findComment-1397684 Share on other sites More sharing options...
Muddy_Funster Posted December 5, 2012 Share Posted December 5, 2012 to me, neither your code nor reply make any sense. Why not send an array in the first place, and why are you doing this? That question still stands. Quote Link to comment https://forums.phpfreaks.com/topic/271629-methods-variables/#findComment-1397685 Share on other sites More sharing options...
Barand Posted December 5, 2012 Share Posted December 5, 2012 or there is func_get_args Quote Link to comment https://forums.phpfreaks.com/topic/271629-methods-variables/#findComment-1397702 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.