You are here: Re: preg_replace help « All PHP « IT news, forums, messages
Re: preg_replace help

Posted by robert on 04/25/06 16:52

your post isn't clear. you have an array of user id's between two apps as
follows?

| An example of the array is as follows:

| 1->62
| 11->63
| 12->64
| 15->69

but then you say you don't want to build an array b/c the size will impact
performance...right? if that's true, then why are you asking how to go about
using the array that you don't want to build for replacing what you find in
$buffer? not sure i follow...anyway, based on your following requirement...

| So I am trying to use preg_replace to simply replace
| any key with the value.

array_flip() yeilds:

62->1
63->11
64->12
69->15

if that settles it, then great. otherwise, is it really $buffer that we
should be concerned with? if so, what does it look like? you should note
that str_replace() is always faster than preg and that preg has memory
limitations (defaults to about 6 MB limit unless php is compiled otherwise -
which slows it even further when the limit is increased).

if you can be more specific, perhaps i can give you a more concise answer
that directly applies.

cheers.

 

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

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