PHP acquainted exhibit creation: Here, we will figure out how to make a cooperative cluster in PHP?
In an affiliated cluster, we can determine the values with the keys. At that point, the following two things are required to make an affiliated cluster: 1) key, and 2) value
the key can be utilized as a record to get to the value from the cluster.
Note: To make a cooperative or different kind of the cluster, we use array() function.
array(key1=>value1, key2=>value2, key3=>value3, ...);
Right now, are making a cooperative exhibit, printing the values: 1) Using keys, and 2) Printing total cluster with keys and values
<?php //creating student array with keys & values $std = array('id' => "121", 'name' => "Kishan", 'course' => "B.Tech"); //printing elemenets print ("std elements...\n"); print ("Id = " . $std['id'] . " Name = " . $std['name'] . " Course = " . $std['course']); //printing array using for each loop //printing complete array print ("std...\n"); print_r($std); ?>
std elements... Id = 101 Name = Amit Course = B.Techstd... Array ( [id] => 121 [name] => Kishan [course] => B.Tech )