You are here: Re: explanation please « PHP Programming Language « IT news, forums, messages
Re: explanation please

Posted by Justin Koivisto on 09/08/05 16:55

Michael G wrote:

> "Michael G" <mike-g@montana.com> wrote in message
> news:1126133711_18365@spool6-east.superfeed.net...
>
>>"muldoonaz" <donot@spam.me.com> wrote in message
>>news:Q0JTe.296169$WN5.93062@fe02.news.easynews.com...
>>
>>>Michael G wrote:
>>>
>>>>The following is from
>>>>http://php.mirrors.ilisys.com.au/manual/en/security.database.sql-injection.php .
>>>>
>>>>Would someone explain the following lines, in particular I don't
>
> >> return preg_replace('/\{(.*?)\}/ei','$paramArr[\'$1\']',
> $queryString);
>
>>>}
>>>
>>
>>But I still fail to understand how 'paramArr[\'$1\']' is mapped using $1
>>as an index. I've tried printing paramArr['$1'] to see if I might gain
>>some understanding but to no avail.
>>
>
>
> ok. I have an explanation, thanks to a Perl book I have. Anyway, the $1 is
> called a backreference. Backreferences contain the value that is matched by
> each atom of the regular expression. In this case there is only one atom -
> (.*?), hence only one backreference. So each time there is a match the value
> contained in the curly braces would be copied into the backreference. So
> $paramArr['$1'] after the first match would give $paramArr['0'] as per the
> regex. Not real sure about what the modifiers 'ei' mean at the end of the
> pattern.

IIRC, the 'e' modifier is for expand or evaluate, and I know that the
'i' modifier is case-insensitive matching.

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

 

Navigation:

[Reply to this 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

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