Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11988 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66229 invoked by uid 1010); 7 Aug 2004 13:17:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 66205 invoked from network); 7 Aug 2004 13:17:05 -0000 Received: from unknown (HELO admin01-nyc.clicvu.com) (209.10.150.70) by pb1.pair.com with SMTP; 7 Aug 2004 13:17:05 -0000 Received: from smtp.clicvu.com ([192.168.0.71]) by admin01-nyc.clicvu.com (Post.Office MTA v3.5.3 release 223 ID# 0-64039U1000L100S0V35) with ESMTP id com for ; Sat, 7 Aug 2004 09:14:50 -0400 Content-type: text/plain Date: Sat, 07 Aug 2004 09:14:35 -0400 To: internals@lists.php.net Subject: Substring writes and buffered char streams From: jtl_phpdotnet@spamex.com Message-ID: Hello PHP gurus, The php-general list does not believe that PHP allows me to do either of the following: (1) Writing an arbitrary substring of a string directly to a stream without first creating a string object for the substring. I.E. There is no print($string, $start, $length) or fwrite($resource, $string, $length, $start). (2) Creating multiple independent buffered characters streams. It appears that stdout is the only instance available. I need to be able to do the first to prevent a costly proliferation of string objects when parsing an input string and producing a new output string from it's substrings. My experience writing Java parsers for business portals clearly demonstrates that object creation, and particularly string creation, is a limiting factor to throughput. Fixing this problem in PHP seems easy: we just need to add an optional start-offset parameter to fwrite(). I don't think I absolutely need the second feature, as I'm emulating multiple buffered character streams by saving and restoring the contents of stdout (via the output buffer) when switching between instances. I just have to keep the application smart about switching so that I can minimize the switch costs. However, it's possible that this could become an issue. I can't create or use a PHP module since my customers generally only have FTP access to their web sites -- not even telnet, much less the ability to customize their PHP configuration. So, is it truly impossible to do these things? If so, when could I hope to see these features -- or at least feature (1) -- ship with core PHP? Thank you for your help! ~joe