I made a php script where you have to add things to your bucketlist, but it isn't working properly. The script needs to output the bucketlist, but it only outputs the last value that is entered.
<?php
echo "How much activities would you like to add?\n";
$a = readline ();
$d = "What do you want to add to your bucket list?\n";
if (is_numeric($a)) {
for ($x = 1; $x <= $a; $x++) {
echo $d;
$c = readline();
}
} else {
echo "'$a' isn't a number, try again.";
exit;
}
$bucketlist = [$c];
array_push($bucketlist);
foreach ($bucketlist as $z) {
echo "On your bucket list:\n";
echo $z;
echo "\n";
}
?>
I need it to output everything that is entered in readline $c