find and replace in php

From: Date: Tue, 02 Jul 2002 17:52:37 +0000
Subject: find and replace in php
Groups: php.general 
Request: Send a blank email to php-general+get-104974@lists.php.net to get a copy of this message
Imagine I have a piece of text "Dear [firstname] Thankyou for purchasing [product] on [date]. We're sure you'll be very [expectation]. Ta Very much." Whats the easiest way to replace all the things in square brackets with variables of the same name. i.e. $firstname, $product, $date, $expectation Whilst ensuring that if the variable doesn't exist then it will be replaced with "" (absolutely nothing). Thankyou in advance Henry

« previous php.general (#104974) next »