I am making a test version of adding users to an array and need to find a way to add the user's name variable to my array.
I am using Repl.it's PHP Web Server, which means it runs in a browser (because Chrome OS) and just have PHP. My code looks somewhat like :
<html>
<body>
Welcome <?php echo $_POST["name"]; ?><br>
You will be added to a list of users
<?php
$usernames = array("John Kennedy", "Barrack Ohbama", "Abraham Lincon")
array_push ($usernames, $_POST["name"]);
for($x = 0; $x < $arrlength; $x++) {
echo $usernames[$x];
echo "<br>";
}
?>
</body>
</html>
But when I plug it in, I get:
172.18.0.1:51360 [500]: /list.php - syntax error, unexpected 'array_push' (T_STRING) in /home/runner/list.php on line 8