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
create xml script using coldfusion
Connecting Outlook 2010 to an exchange server remotely
Microsoft access 2010 pegs the CPU
GFI 2010 Limits exchange 2003 incoming email 2 mb! ARGH!
PC will not reboot unless press power button
ESXi compatible hardware
Provide Current mm as @AsOfMonth and current yyyy as @AsOfYear
HTML - SQL - Carrying Form Variables from Page to Page
Foxpro and using Excel 2010 as an object
Launching an Access form with pre-filled fields