Background
[wp_ad_camp_1]
PHP is not as bad as other people would think. Sometimes it is easier to do things in PHP than in, say, Java. Consider reading a text file line by line and parsing each pipe-delimited line.
Hardware Environment
n/a
Software Environment
- Windows 7 Professional SP1
- PHP 5.5.9 / Zend Engine v2.5.0
PHP Codes
That’s less than 10 lines. Way less codes than in Java.
1 2 3 4 5 6 7 8 9 10 11 | $file = fopen('data.txt', 'r'); while(($line = fgets($file)) != false) { $fields = explode("|", $line); foreach($fields as $value) { echo $value . "\n"; } } fclose($file); |
Sample Output
[wp_ad_camp_2]
[wp_ad_camp_3]