Search notes:

PHP code snippets: array_push()

array_push($ary, $elem) adds the element $elem to the array $ary.
<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>array_push</title>
</head>
<body>

  <?php

    $a = array("foo", "bar");
    array_push($a, "baz");

    print join ("<br>", $a);

  ?>

</body>
</html>

Github repository about-php, path: /array/push.html

See also

Other PHP snippets

Index