Skip to content

How to create an associative array in PHP?

<?php
	$associativeArray = [
        "carOne" => "BMW",
        "carTwo" => "VW",
        "carThree" => "Mercedes"
    ];
    
    echo $associativeArray["carTwo"] . " Is a german brand";
?>
See also  CSS code snippet - How to use input border?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.