असोसिएटिव सरणी में मान पुश करने के लिए, ब्रैकेट्स [] [] का उपयोग करें। पहले एक असोसिएटिव सरणी बनाएं:
$details= array (
'id' => '101',
'name' => 'John Smith',
'countryName' => 'US'
);
मान डालने के लिए PHP कोड इस प्रकार है:
उदाहरण
<!DOCTYPE html>
<html>
<body>
<?php
$details= array (
'id' => '101',
'name' => 'John Smith',
'countryName' => 'US'
);
$all_details['studentDetails'][] = $details;
print_r($all_details);
?>
</body>
</html>
आउटपुट
Array (
[studentDetails] => Array (
[0] => Array (
[id] => 101
[name] => John Smith
[countryName] => US
)
)
)