I decided for myself to put the first "big" task after "Hello World" in PHP to make a table that will pull the values from the php file (part 2 is writing to the file from the page). I finally launched debager, but have not yet figured it out (
The code should from this data, which are now written in the txt file, build a 3x3 table! The code says that it does not find the 1st and 2nd index in $ mass ! But it displays the values in 1 line without _ and without;. In the code of the page, he does not even add for some reason html table code. Tell me please, where is the error in the code?
file.php
<?php $string1=file("table.txt"); for($i=0;$i<count($string1);$i++){ $datatxt=explode(";", $string1[$i]); for($i=0;$i<count($datatxt);$i++){ $mass=explode("_",$datatxt[$i]); $name=$mass[0]; $surname=$mass[1]; $age=$mass[2]; echo "<tr><td>".$name."</td>"; echo "<td>".$surname."</td>"; echo "<td>".$age."</td></tr>";}} ?> table.txt
Angela_First_16;Lily_Oto_18;Ann_Girl_31;