note 53450 deleted from function.preg-replace by didou

From: Date: Thu, 02 Jun 2005 10:16:00 +0000
Subject: note 53450 deleted from function.preg-replace by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-89775@lists.php.net to get a copy of this message
Note Submitter: daevid at daevid dot com Reason: bad code ---- I often times format my SQL queries in a readable way, however when i want to debug, it's not always desireable to have them formatted, as it often looks goofy and tabs are not right. Here's a quick way to make the SQL statment all on one single line (insert into your own SQL wrapper as desired -- you are using a SQL wrapper right?): <?php $sql = "SELECT RT.foo, NR.bar FROM ResultTable RT, NetworkTable NR WHERE NR.s_id = RT.s_id AND NR.r_id = RT.r_id AND RT.IPAddress = NR.ipaddr AND RT.MAC = NR.MAC"; $sql = preg_replace("/\s+/",' ', (preg_replace("/\s/",' ',$sql)) ); echo "SQL: ".$sql."\n"; ?>

« previous php.notes (#89775) next »