count in php code example
Example 1: filesize in php
$file = '/path/to/your/file';
$filesize = filesize($file);
$filesize = round($filesize / 1024 / 1024, 1);
echo "The size of your file is $filesize MB.";
Example 2: php length of array
<?php
$arr = ["one", "two", "three", "four"];
echo count($arr);
?>
Example 3: count sql query in php
$sql = "SELECT COUNT(*) AS total from Members";
$result = $conn->query($sql);
$data = $result->fetch_assoc();
echo $data['total'];
Example 4: count php
$cars = array("Volvo","BMW","Toyota");
echo count($cars);
Example 5: filesize in php
$file = '/path/to/your/file';
$filesize = filesize($file);
$filesize = round($filesize / 1024, 2);
echo "The size of your file is $filesize KB.";