Hi Curt,

You could use a function of the name and signature you gave, but if you implement it 
in PHP, you're still creating the substring objects that I don't want created.  Notice 
your call to substr().  Object creation is expensive.  If the function were 
implemented natively, the language need only copy bytes directly from a portion of the 
source string over to the output buffer.

Thanks for taking a stab!
~joe

On 8/3/2004 Curt Zirzow wrote:
>I'm not entirely clear at what your trying to do but perhaps you
>want something like this:
>
>function print_substr_direct($string, $start, $len) {
>  static $fp = null;
>
>  if ($fp === null ) {
>    // Open a connection directly to the output
>    $fp = fopen('php://stdout', 'r');
>  }
>  if ($fp) {
>    fputs($fp, substr($string, $start, $len));
>  }
>}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to