Skip to content

Instantly share code, notes, and snippets.

@augustohp
Created April 10, 2012 19:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save augustohp/2353792 to your computer and use it in GitHub Desktop.
Save augustohp/2353792 to your computer and use it in GitHub Desktop.
SQL formater for PHP by @alganet
function formatSql($sql) {
return preg_replace(
'/(select|from|(left |right |natural |inner |outer |cross |straight_)*join|where|limit|update |set|insert |values)/i',
"\n$1\n ", str_replace("\n", '', $sql)
);
}
@wesleyvicthor
Copy link

put it in an utils class.

@alganet
Copy link

alganet commented Apr 13, 2012

Util classes must die. If there's an Util class, everything else is Useless?

@augustohp
Copy link
Author

LMAO

@wesleyvicthor
Copy link

I said that because i know that you do not like. successful troll. (:

@augustohp
Copy link
Author

Sure, we know... we know...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment