Answers for "for $i php"

PHP
1

for php

<?php
	$fruits = ["apple", "banana", "orange"];
	for ($i = 0; $i < count($fruits); $i++) {
      	echo "Index of ".$i."= ".$fruits[$i]."<br>";
    }
	// or
	$i = 0;
	foreach ($fruits as $value) {
    	echo "Index of ".$i."= ".$value."<br>";
      	$i++;
	}
?>
Posted by: Guest on April-17-2021

Browse Popular Code Answers by Language