Answers for "file stop when fullstop is encountered in php"

PHP
1

file stop when fullstop is encountered in php

$fptr =  fopen('myfile.txt','r');
    if(!$fptr)
    {
        die("Could not open file");
    }
// it will read character by character
    while($line = fgetc($fptr))
    {
        echo $line;
        // stop when fullstop is encountered
        if($line == '.')
        {
            break;
        }
    }
Posted by: Guest on October-12-2021

Code answers related to "file stop when fullstop is encountered in php"

Browse Popular Code Answers by Language