অ্যাসোসিয়েটিভ অ্যারেতে মান পুশ করতে, ব্র্যাকেট [] [] ব্যবহার করুন। প্রথমে একটি অ্যাসোসিয়েটিভ অ্যারে তৈরি করুন −
$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 ) ) )