How to expand the $STR layer according to $hello data?
How to expand the $STR layer according to $hello data?
PHP Code
"Dir_ws_template. ' includes/'", "dir_ws_classes" and " dir_ws_admin. ' HelloWorld '", "dir_ws_template " = =" template/", " dir_ws_admin " =" admin/" );//How to get such an array of results: $my _arr=array ( " Dir_fs_aaa. Dir_ws_classes ", " dir_ws_template. ' includes/'. Dir_ws_template. ' includes/' ", " template/includes/admin/includes/" );? >
------Solution--------------------
PHP code
$my _arr[] = $str; $tmp = preg_replace ("/[a-z_]+/e", "\ $hello [' \\0 ']", $str); $my _arr[] = $tmp; $tmp = preg_replace ("/[\" ']?\s*\.? \s* ([a-z_]+) \s*\.? \s*[\ "']/e", "\ $hello [' \\1 ']", $tmp); $my _arr[] = $tmp;//testprint_r ($my _arr);/**array ([0] = dir_fs_aaa. dir_ws_classes [1] = = dir_ws_template. ' includes/'. Dir_ws_admin. ' HelloWorld ' [2] = Template/includes/admin/helloworld ')/**/