|
Posted by mens libertina on 08/18/06 02:18
Jerry Stuckle wrote:
> No, you can also make it a global in the function and not pass it as a parm.
>
> The one thing to remember - variable names in a function are only known
> within that function. They can't be used outside of it.
>
> Global variables can be used anyplace.
OK, I used the global keyword and verified it (via print_r() ) in the
function, but I get nothing when I add print statements to
preg_replace_callback() :
$tagpatt = '/\{(\w+?)\}/';
$emesg = preg_replace_callback( $tagpatt,
create_function( '$matches',
'print_r($matches);print_r($info);$field=strtolower($matches[1]);return
$info[$field];' ),
$emesg );
It seems like p_r_c() can't do what I want, but it's seems to be
designed for just this type of backreference manipulation. Am I just
going about this the wrong way?
Navigation:
[Reply to this message]
|