I need ob_write($string, $start, $length)
| From: | jtl_phpdotnet at spamex dot com | Date: | Tue, 03 Aug 2004 03:58:58 +0000 |
| Subject: | I need ob_write($string, $start, $length) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-192517@lists.php.net to get a copy of this message | ||
The guys in the internals list sent me to this forum.
I am trying to write some serious parsing software in PHP. I need to use plain, vanilla PHP and no
add-on modules, because I need to be able to distribute to people who don't have sufficient
privileges.
In the process of parsing I create a new document composed of concatenated pieces of the original
document. I am efficiently catting the new document using output buffer, but when I have to copy
non-contiguous pieces form the original document, I am forced to create substrings, as in:
echo substr($originalDoc, $startOfSnippet, $snippetLength)
My documents are potentially large with possibly thousands of such substrings. I know from writing
Java parsers for high-throughput servers that object creation, and in particular string creation, is
the greatest source of degraded performance.
I'd like to copy the contents of a substring directly to the output buffer without creating an
intermediate object, as in:
ob_write($string, $start, $length)
I can find no such function and could envision no other way to do this at present.
When can I expect broad support for such a function in the base PHP release? Or do you know of a
workaround?
BTW, because I had to ditch my last email address due to spam, I'm subscribed to this list
through spamex.com. But because the list makes the emails it distributes appear to original from
the people who posted, I have no way to reply through spamex back to this forum, at least no way to
keep the reply in the same thread. Suggestions, are welcome. Otherwise I'll be starting a new
thread.
Thanks for your help!
~joe lapp