[Phpwm] Passing parameters to callback functions
Alex Mace
alex at hollytree.co.uk
Mon May 19 10:26:54 BST 2008
There doesn't seem to be any documented way of doing that in the manual.
What are you actually trying to achieve? Perhaps there is an easier
alternative...
On 19 May 2008, at 10:05, Mike Tipping wrote:
> I'm using preg_replace_callback() to replace content in a CMS system
> but
> need to pass some extra parameters to the call back function in
> addition to
> the matches array that is passed by default:
>
> $fileContent = preg_replace_callback('/{cms id="([\d]*)"}/'
> ,array($this,'replaceContent'), $fileContent);
>
> So replaceContent is defined as
>
> Function replaceContent($matches, $year, $month)
>
> Does anyone know if I can pass the $year, $month and how to do it. I
> know I
> can assign it to a class or session variable but this seems messy.
>
>
>
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm
More information about the Phpwm
mailing list