Quantcast
Viewing all articles
Browse latest Browse all 4

Answer by kwelsan for php function file_get_contents and first line of UTF-8 encoded text

Please try below updated code:

$array_test = array();$file = file_get_contents ('./test.txt');$file_array = explode("\n", $file);foreach ($file_array as $line) {    $word = trim($line);    $array_test[] = $word;}echo $array_test[0];if ($array_test[0][0] == "1") { echo 'first line'; }echo $array_test[1];if ($array_test[1][0] == "2") { echo 'second line'; }

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>