I can do the following:
$fopen = fopen($file_name, 'r');
$data = fgets($fopen, 16384);
fclose($fopen);
But is their any way I could emulate the same functionality but on a string (instead of using a file name)?
$string = file_get_contents($file_name); /* just for demonstration purposes */
$data = /* do something here...*/
Hope that made sense.
There are lots of function defined for String manipulation here. You can choose any of them which fulfills your requirements.
Probably you need substr()