Re: beginner question on multidimensional arrays
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: beginner question on multidimensional arrays

From: crucialmoment <crucialmoment@gmail.com>
Date: Tue Jan 31 2006 - 13:10:39 CET

Here's an example using preg_replace

   $pattern[0] = '/\/';
   $pattern[1] = '/\}/';
   $pattern[2] = '/\$/';
   $pattern[3] = "/\%/";
   $replacement[0] = '&#123;';
   $replacement[1] = '&#125;';
   $replacement[2] = '&#36;';
   $replacement[3] = '&#37;';
   $myvar = preg_replace($pattern, $replacement, $myvar);

$pattern is the array of text or characters to search for.
$replacement is what to replace with
In this example, some characters are replaced with their html escape
codes
Received on Tue Feb 7 21:08:15 2006