Answers for "associative array example"

PHP
5

how to create an associative array in php

<?php
	$associativeArray = [
        "carOne" => "BMW",
        "carTwo" => "VW",
        "carThree" => "Mercedes"
    ];
    
    echo $associativeArray["carTwo"] . " Is a german brand";
?>
Posted by: Guest on February-18-2020
0

associative array example

C:\wamp64\www\myNerdvtest\api\teachers\posts.php:146:
array (size=5)
  0 => 
    array (size=4)
      'id' => int 1
      'age' => int 20
      'class' => string 's4' (length=2)
      'else' => string 'no more' (length=7)
  1 => 
    array (size=4)
      'id' => int 2
      'age' => int 23
      'class' => string 's5' (length=2)
      'else' => string 'no more' (length=7)
  2 => 
    array (size=4)
      'id' => int 3
      'age' => int 19
      'class' => string 's3' (length=2)
      'else' => string 'sturbon' (length=7)
  3 => 
    array (size=4)
      'id' => int 4
      'age' => int 27
      'class' => string 's6' (length=2)
      'else' => string 'aahhh' (length=5)
  4 => 
    array (size=4)
      'id' => int 5
      'age' => int 20
      'class' => string 's6' (length=2)
      'else' => string 'humble' (length=6)
Posted by: Guest on July-10-2021

Code answers related to "associative array example"

Browse Popular Code Answers by Language