newbtophp Posted November 20, 2009 Share Posted November 20, 2009 Im doing the following, it works fine, but was wondering how'd I shorten the number of code, perhaps into 1 preg_replace? $code = str_replace('( ', '(', $code); $code = str_replace(' );', ');', $code); $code = str_replace(' )', ')', $code); $code = str_replace(' ( ', '(', $code); $code = str_replace(' ( ', '(', $code); $code = str_replace(' )', ')', $code); $code = str_replace(' )', ')', $code); $code = str_replace(' (', '(', $code); Link to comment https://forums.phpfreaks.com/topic/182338-solved-shorten-up-code-to-preg_replace/ Share on other sites More sharing options...
nrg_alpha Posted November 20, 2009 Share Posted November 20, 2009 One method could probably involve an array using strtr. Link to comment https://forums.phpfreaks.com/topic/182338-solved-shorten-up-code-to-preg_replace/#findComment-962210 Share on other sites More sharing options...
newbtophp Posted November 20, 2009 Author Share Posted November 20, 2009 One method could probably involve an array using strtr. cooool, thanks alot! Link to comment https://forums.phpfreaks.com/topic/182338-solved-shorten-up-code-to-preg_replace/#findComment-962218 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.