note 115375 added to function.call-user-method-array

From: Date: Tue, 15 Jul 2014 07:57:59 +0000
Subject: note 115375 added to function.call-user-method-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-199930@lists.php.net to get a copy of this message
<?php class a{ function b($a,$b,$c){ echo $a." ".$b." ".$c; } function c(Array $a, Array $b){ print_r($a); echo "<br />"; print_r($b); } function cuf(Array $a, Array $b){ print_r($a); echo "<br />"; print_r($b); } } $a = new a; // ### Just String Params ### $array = array("Musa ATALAY",":","Software Developer"); $str = NULL; foreach($array AS $v){ if(is_string($v)){ $str.="'".$v."',"; }else{ $str.=$v; } } $str = rtrim($str,","); $run = "echo \$a->b(".$str.");"; echo "<br />"; eval($run); $str = NULL; /* OUTPUT : Musa ATALAY : Software Developer */ // ### With Array Params ### $array = array(array("Musa ATALAY",":","Software Developer"),array("Musa ATALAY",":","Software Developer")); foreach($array AS $i => $v){ if(is_string($v)){ $str.="'".$v."',"; }else{ $str.="\$array[".$i."],"; } } $str = rtrim($str,","); $run = "echo \$a->c(".$str.");"; echo "<br />"; eval($run); /* OUTPUT : Musa ATALAY : Software Developer Musa ATALAY : Software Developer */ ?> ---- Server IP: 72.52.91.14 Probable Submitter: 78.189.215.97 ---- Manual Page -- http://php.net/manual/en/function.call-user-method-array.php Edit -- https://master.php.net/note/edit/115375 Del: integrated -- https://master.php.net/note/delete/115375/integrated Del: useless -- https://master.php.net/note/delete/115375/useless Del: bad code -- https://master.php.net/note/delete/115375/bad+code Del: spam -- https://master.php.net/note/delete/115375/spam Del: non-english -- https://master.php.net/note/delete/115375/non-english Del: in docs -- https://master.php.net/note/delete/115375/in+docs Del: other reasons-- https://master.php.net/note/delete/115375 Reject -- https://master.php.net/note/reject/115375 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199930) next »