note 7900 added to ereg
| From: | coop at better-mouse-trap dot com | Date: | Fri, 18 Aug 2000 23:14:30 +0000 |
| Subject: | note 7900 added to ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2546@lists.php.net to get a copy of this message | ||
I had some problems embedding the the value of a variable into my match string inside the quotes, so
I found that assembling the string with concatenation operators worked better. This might be my own
(newbie) ignorance of PHP's variable interpolation inside of quotes, but in case it's
helpful to someone else:
This didn't work:
ereg("^$prefix_([^_]+)_(.+)$", $subject, $results);
But this did:
ereg ("^" . $prefix . "_([^_]+)_(.+)$", $subject, $results)
http://www.php.net/manual/function.ereg.php