Q:

Write a PHP script to count number of lines in a file

0

Write a PHP script to count number of lines in a file.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$file = basename($_SERVER['PHP_SELF']); 
$no_of_lines = count(file($file)); 
echo "There are $no_of_lines lines in $file"."\n";
?>

Sample Output:

There are 5 lines in a6924e70-5a4c-11e7-b47b-99347412a245.php

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now