Reply to Re: parsing template using preg_replace_callback()

Your name:

Reply:


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?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация