Microsoft
Software
Hardware
Network
Question : PHP: Find and Replace only 1st occurance
I want PHP to go through my string and only replace the first occurrence of the words I want replaced. str_replace seems to replace every occurrence, I just want to have the 1st occurrence replaced. How can I go about doing this?
Answer : PHP: Find and Replace only 1st occurance
Use preg_replace ...here is an example..
<?
$var = 'abcdef abcdef abcdef';
// pattern, replacement, string, limit
echo preg_replace('/abc/', '123', $var, 1); // outputs '123def abcdef abcdef'
?>
Random Solutions
recover exchange database from sbs 2008
Rmail add file attachment how-to ?
Rollover flash "SWF" files are not working in internet explorer
system info via website
Datamax DPL VB sample
How do you join a Snow Leopard Client to Windows SBS 2008 domain
Adding Columns to ASP.Net Gridview Control
Set up Blackberry to work with OWA
your computer appears to be correctly configured but the device or resource (
www.google.com
) is not responding
Exchange Database will not mount.