|
Posted by Wolverine on 04/25/06 18:05
Well, I posted a reply over 30 mins ago and it's apparently not gonna
show. Maybe I'm just a G group newbie.
Sure, I can be more specific, sorry for the clarity issue.
The user_array is selected from the MySQL db and is composed of the
corresponding user id's from two systems. The buffer is html and in
the buffer are links to user profiles that are composed with the user
id in the URL (i.e. http://blahblah.com/index.php?foo=bar&u=15). I
need to search and replace all occurrences of u=15 with user=69, for
example. There are other changes to the URL but those I have already
addressed.
So my concern that I previously stated unclearly wasn't with building
the user id array it is actually with building two arrays to search and
replace all user id's. There are some sites with >10k users. In
addition, on any given page with these URL's I estimate at most maybe
15% of the user id's in the links. It seems very inefficient to build
a full search and replace array for every user id especially
considering this is processed each and every time the page loads.
So if $user_array is composed of $key $value pairs what I need to
accomplish is replacing u=$key with user=$value. I thought I could
accomplish this using regular exp like this:
preg_replace(/u=/(\d+), 'user='.$user_array["$1"], $buffer)
where $1 is back reference integer found in the search. Does that
clear things up? Thanks for the help!
Navigation:
[Reply to this message]
|