Answers for "looping string php"

PHP
1

How to write a loop in PHP

<?php

//FOR each item within the array, "ECHO" out the index ($i) and value of each item.
$numbersArray = [1, 2, 3]
for($i = 0; $i < count($numbersArray); $i++) {
	echo "Index of ".$i."= ".$numbersArray[$i]."<br>";
}

?>
Posted by: Guest on March-16-2022
0

php loop through string

// Step 1: convert the string to an array using the str_split function

$array = str_split($your_string);

// Step 2: loop through the newly created array

foreach ($array as $char) {
 echo $char;
}
Posted by: Guest on May-09-2022
0

php loop

/*teting*/
Posted by: Guest on February-04-2022

Browse Popular Code Answers by Language