taith Posted December 19, 2006 Share Posted December 19, 2006 trying to remove all ,'s from a string, but i get a nice error...[code]$i= preg_replace(",", '', $i);[/code]Warning: preg_replace() [function.preg-replace]: No ending delimiter ',' found in /home/.sites/16/site168/web/taith/md5.php on line 3 Link to comment https://forums.phpfreaks.com/topic/31267-solved-preg_replace/ Share on other sites More sharing options...
Orio Posted December 19, 2006 Share Posted December 19, 2006 The preg functions require the expression to be wrapped by two slashes.[code]$i= preg_replace("/,/", '', $i);[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/31267-solved-preg_replace/#findComment-144671 Share on other sites More sharing options...
kenrbnsn Posted December 19, 2006 Share Posted December 19, 2006 Use str_replace() instead:[code]<?php$i = str_replace(',','',$i);?>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/31267-solved-preg_replace/#findComment-144673 Share on other sites More sharing options...
taith Posted December 19, 2006 Author Share Posted December 19, 2006 thats it! str_replace... lol... knew i was doin somin wrong ;-) thanks :-P Link to comment https://forums.phpfreaks.com/topic/31267-solved-preg_replace/#findComment-144677 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.