Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中向变量添加函数,然后执行_Php - Fatal编程技术网

如何在php中向变量添加函数,然后执行

如何在php中向变量添加函数,然后执行,php,Php,我想添加函数getAddress();将变量转换为$fulltarget,然后执行具有getAddress()值的相关变量的结果 变量代码如下..请更正..就是这样 $fulltarget="getAddress(){$target}{$fullname}"; 如何做到这一点…我的意思是它不会回显getAddress()的结果;所以请…告诉我有什么问题 等待您的答复…也请注意,因为我是新来的…所以请避免以否定的方式投票…从这个意义上说…您不能在字符串中执行函数。您需要将其连接到字符串中 $fu

我想添加函数getAddress();将变量转换为$fulltarget,然后执行具有getAddress()值的相关变量的结果

变量代码如下..请更正..就是这样

$fulltarget="getAddress(){$target}{$fullname}";
如何做到这一点…我的意思是它不会回显getAddress()的结果;所以请…告诉我有什么问题


等待您的答复…也请注意,因为我是新来的…所以请避免以否定的方式投票…从这个意义上说…

您不能在字符串中执行函数。您需要将其连接到字符串中

$fulltarget= getAddress() . "{$target}{$fullname}";

是否要添加调用该函数的结果?然后你可以像下面这样

$fulltarget = getAddress()."{$target}{$fullname}";