note 115375 deleted from function.call-user-method-array by cmb
| From: | cmb@php.net | Date: | Sun, 25 Oct 2020 13:15:56 +0000 |
| Subject: | note 115375 deleted from function.call-user-method-array by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215646@lists.php.net to get a copy of this message | ||
Note Submitter: musaatalay dot mobile at gmail dot com
----
<?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
*/
?>