treat a string like a file
Posted: Wed Jul 02, 2008 6:59 pm
Is there any way to treat a string like a file in PHP?
For example...I have a string: $str = "Hi, I'm a string in php";
and I have a file "hi.txt" and its contents are "Hi, I'm a file in php".
Now with hi.txt, I can do all kinds of file operations like fgetcsv().
Is there any way that I can do these operations on the string? Sort of trick PHP into thinking that $str is actually a file that I can get a $handle on.
For example...I have a string: $str = "Hi, I'm a string in php";
and I have a file "hi.txt" and its contents are "Hi, I'm a file in php".
Now with hi.txt, I can do all kinds of file operations like fgetcsv().
Is there any way that I can do these operations on the string? Sort of trick PHP into thinking that $str is actually a file that I can get a $handle on.