MemoryRefresh!

Streams / File parse   File parse



Questions Answers 0%

Pages   0 from 91
Questions   0 from 142

Reset


fscanf()
<?php // Parses input from a file according to a format // Similar to sscanf(), but it takes its input from a file associated with handle /* -- example.txt John Smith 24 Mary Jones 35 Tom Ferguson 45 */ $fp = fopen("example.txt", "r"); while($row = fscanf($fp, "%st%st%dn")) { list($surname, $name, $age) = $row; echo "{$name} {$age}"; break; // Outputs: Smith 24 } fclose($fp);
1) Parse input from a file







fscanf()
<?php // Parses input from a file according to a format // Similar to sscanf(), but it takes its input from a file associated with handle /* -- example.txt John Smith 24 Mary Jones 35 Tom Ferguson 45 */ $fp = fopen("example.txt", "r"); while($row = fscanf($fp, "%st%st%dn")) { list($surname, $name, $age) = $row; echo "{$name} {$age}"; break; // Outputs: Smith 24 } fclose($fp);

References









Programming

Php
   
Regex
   
MySQL
   
Css
   
jQuery
   
Git
   


References