Jump to content

[SOLVED] Shorten up code to preg_replace


newbtophp

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.