Home / Learn / PHP Basics / PHP Arrays

PHP Arrays

Learn how to define PHP arrays and it's use cases.

3 years ago

189

Code Example

<?php

$stringArray = ["Potato", "Tomato", "Eggplant", "Carrot", "Mushroom"];

$numberArray = [1, 2, 3, 4, 5];

$mixArray = ["a", true, false, null, 1.2];

$associativeArray = [
	"name" => "John Doe",
	"age" => 23
];

$multidimensionalArray = [
	[ "name" => "John Doe" ],
	[ "name" => "Jane Doe" ]
];
                    

Code Snippets

Collection of Laravel, AlpineJS, VueJS, Tailwind CSS, Flutter snippets and more. New snippets added every day.
View Snippets

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this