Execute PHP code from a string.
App::Utility()->parsePHP(String, Option)
Parameter |
Description |
---|---|
String |
String value with PHP code |
Options |
Pass variable in string |
See bellow example:
$data = 'Say some greeting<br />
{php} echo "Hello, Mr. $name"; {/php}<br />
<?php echo "Hi, $name"; ?>';
$str = App::Utility()->parsePHP($data, array('name'=>'Junal));
echo($str);
/* Output
Say some greeting<br />
Hello, Mr. Junal Rahman<br />
Hi, Junal Rahman
*/