hello everybody.
as some of you might know, you can force php to parse a piece of code in a regular expresion using the /e modifier (http://php.net/preg_replace).
for example:
<?php
preg_replace("/(<\/?)(\w+)([^>]*>)/e",
"'\\1' . strtoupper('\\2') . '\\3'",
$html_body);
?>
This would capitalize all HTML tags in the input text.
as you can see on the example above, php parses regular functions like strtotupper() using the /e modifier.
my question is what if i need to parse a class object instead of a function
like:
<?php
$someclass = new someclass();
preg_replace("/(<\/?)(\w+)([^>]*>)/e",
"'\\1' . $someclass->somefunction('\\2') . '\\3'",
$html_body);
?>
any help or comment is very appreciated.
regards,
cristian