Re: mysterious " f " character appearing. Why??
| From: | Michael A. Peters | Date: | Fri, 10 Jul 2009 02:13:52 +0000 |
| Subject: | Re: mysterious " f " character appearing. Why?? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295122@lists.php.net to get a copy of this message | ||
HallMarc Websites wrote:
LOL - I wanted to display generated XML on screen. Displaying it as a big long string doesn't work so well, so I passed it through tidy just to get pretty indentation. Tidy did a pretty could job, but for the life of me I couldn't figure out how to do an xml fragment with tidy - it always headed head and body tags (the config option for html in tidy is automatically disabled in xml output mode) Anyway - so after using a regex to get rid of the head and body tags, there was excess indention - and I spent almost 20 minutes trying to figure out why '/^\s{4}/','' was only working on the first line. What I was seeing on screen in browser was multiline, but to php (and thus preg_replace) it was still all one string, so ^ would only match once. Sometimes it helps to take a break, watch a Stargate episode, and clear your mind.problem was solved, it was just a simple typo and sometimes all it takes is a fresh pair of eyes. The confusing part comes in when it prints to the screen and your mind looks in that area of the code and finds nothing