Lesson 29 of 3097%

(Progress persistence is disabled until Phase 9)

PHP
Beginner

Array Functions

Learn about Array Functions in PHP.

PHP is a powerful server-side language. In this lesson, we will cover Array Functions.

Real code examples

<?php
$cars = ["Volvo", "BMW", "Toyota"];

echo count($cars); // 3

sort($cars); // Sorts array alphabetically

$newArray = array_merge($cars, ["Honda", "Ford"]);
print_r($newArray);
?>

Common mistakes

Make sure you include the <?php tag when writing PHP!

Try It Yourself

You can experiment with this in the Playground.

Lesson Progress

Take QuizBuild a PHP Project