Tag Archives: For loop

Loading Arrays from Files (use for loop)

<?php
$DOCUMENT_ROOT = $_SERVER[‘DOCUMENT_ROOT’];
$orders=file(“DOCUMENT_ROOT/../orders/orders.txt”);
$number_of_orders = count($orders);
if ($number_of_orders == 0){
echo ”

No orders pending.Please try again later.

“;

}else{

for ($i=0;$i<$number_of_orders;$i++){

echo $orders[$i].”
“;
}

}
?>