Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
dvprog_09 [2015-02-11 22:42] Daniel Viström |
dvprog_09 [2015-09-10 08:49] 127.0.0.1 external edit |
||
---|---|---|---|
Line 25: | Line 25: | ||
file_put_contents(' | file_put_contents(' | ||
- | // Läser en textfil till en sträng. | + | $textfil = ' |
- | $str = file_get_contents(' | + | // Läser en textfil till en sträng. |
- | echo nl2br($str) . '< | + | $str = file_get_contents($textfil); |
+ | echo nl2br($str) . '< | ||
// Läser in en textfil till en array, radbrytning ger ny " | // Läser in en textfil till en array, radbrytning ger ny " | ||
+ | // Varje rad i filen har följande format: | ||
$arr = file(' | $arr = file(' | ||
// print_r($arr); | // print_r($arr); | ||
Line 36: | Line 38: | ||
while ($i < count($arr)) { | while ($i < count($arr)) { | ||
$row = explode(':', | $row = explode(':', | ||
- | // print_r($row); | + | // print_r($row); |
// Skriver bara ut de som heter Svensson i efternamn. | // Skriver bara ut de som heter Svensson i efternamn. | ||
if (trim($row[2]) == ' | if (trim($row[2]) == ' |