Print the value of the variable that is composed for the string in For Loop
In this loop, I am trying to accept the value of a variable, but to save the code, I want to use For Loop to concatenate the part of the variable with the number generated in the loop. This is my attempt.
<?php
$x0 = 0;
$x1 = 1;
$x2 = 2;
$x3 = 3;
for ($i=0; $i < 5; $i++) {
echo '$x'.$i;
}
?>
the result i get is
$ x0 $ x1 $ x2 $ x3 $ x4
I want it to end like this:
0123
+3
source to share