0

I'm wondering if it's possible to override the echo command in PHP so that I could easily string replace new lines with nothing to compress the HTML drawn from the php process. Something like:

class echo($SomeVar){echo str_replace('\n','',$SomeVar);}

I've got no idea how to override a method or class in PHP like I can do with objective-c for example.

I'd just like to "re-echo" every single echo command on the site and compress all the line breaks from my code.

Rather than create a new custom "echo2" method and re-edit the entire site I thought I'd try a simple patch for the real echo command in php first.

Anyone done this?

Thanks in Advance!

Luke
  • 73
  • 1
  • 8
  • 1
    see http://stackoverflow.com/questions/16327709/ob-start-echos-strings-out-still it could help you – Ulrich Horus Jan 15 '14 at 01:25
  • I'm trying not to edit the site code, except for overriding the method - But thanks I'll read up on the link provided. – Luke Jan 15 '14 at 01:48

0 Answers0