MemoryRefresh!

File parse



Questions Answers 0%

Pages   0 from 51
Questions   0 from 84

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);
Questions

Related pages

File open !
Read file !
Read csv !
File contents !
File cache and stats !
File lock !
File parse !
Context !
Network !


0% 100%
 
 
0 pages 51 pages
1) Parse input from a file




Last Review: n/a   Passed: n/a   Reviews: n/a   Next Review: n/a  


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);



More from Php

Basics
Variables
Operators
Function
Array
String
Streams
Uncategorized


More from Programming

Php
jQuery




Powered by minte9.com