Home » Php » PHP – txt file put into an array

PHP – txt file put into an array

Posted by: admin February 25, 2020 Leave a comment

Questions:

My code is

<?php
    $myfile = fopen("myfile.txt","r") or die("Unable to open file!");
    $Ques = array();`file reading into array`
    while(!feof($myfile)){
        $cha = fgetc($myfile);
        if($cha == '@'){`near the @ text should be break`
            echo "<br>";
        }else{
            echo $cha;
        }
    }
    fclose($myfile);
?> 

I want to put file into an array when character equal to ‘@’ symbol

How to&Answers: