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
capturing deletes
Redistributing RIP into OSPF non-contiguous subnets.
SQL Sever 2008 evaluation expired
802.1q trunk
Installing BES on SBS 2008
windows 2003 server can't access internet
SMTP; 554 5.4.0 Too many Received: headers
Sorry, VMware GO doesn't currently support ESXi servers with multiple datastores.
2 raid controllers managing the disk array
SQLCommandBuilder - GetUpdateCommand, GetInsertCommand and GetDeleteCommand Questions