<?php
$list = ['a', 'b', 'c'];
$count = [1, 3, 5];
function stringFormatter($c, $i) {
return "Char is $c & Int is $i";
}
for ($i = 0; i < $list; $i++) {
for ($j = 0; $j < $count; $j++) {
$string = stringFormatter($list[$i], $count[$j]);
print $string;
}
}
?>
This is sample code that I have rewritten to demonstrate an issue I'm having with a program where I want to assign a formatted string, with the right combination of char and int, to be able to execute an SQL statement, using said string. Ideal scenario is getting a string that has the combination of both char and int at that position in their respective lists. E.g. "Char is a & Int is 1". This doesn't currently compile and when I plug it into "Online PHP Sandbox" I get the error message: "Internal Server Error [500]." Any advice on how I could get this to work, or even alternative suggestions are welcome! Thanks in advance!