Re: String to Stream

From: Date: Fri, 05 Aug 2005 18:37:32 +0000
Subject: Re: String to Stream
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220090@lists.php.net to get a copy of this message
Jay Blanchard wrote:
[snip] Jay Blanchard wrote:
If you place the string into a variable then you would be able to work with it that way.
Using what functions? Part of the point was not to need to keep track of the current location in the string, etc...basically things that streams tend to handle well.
There are probably better functions for dealing with a string than the ones you have mentioned (fseek is a file pointer).
'like fscanf, fseek' [/snip] You have been a little vague about your desired usage but here is one idea; Explode the string into an array and then use array functions to navigate the string. Here is a whole list of methods for handling strings.... http://us2.php.net/manual/en/ref.strings.php
Again, I would like to treat the string as a stream. One possible way to accomplish this would be to simply write the string to a temporary file, open the file with fopen and then use fscanf, fseek, etc. to process the text. However, I am assuming there is an easier way (i.e. a method without the file io overhead) to be able to treat the string as a stream. -- == Eric Gorr =============================== http://www.ericgorr.net === "Therefore the considerations of the intelligent always include both benefit and harm." - Sun Tzu == Insults, like violence, are the last refuge of the incompetent... ===

« previous php.general (#220090) next »