array_intersect_assoc() function in php tamil
Learn Php with our comprehensive guide.
array_intersect_assoc() Function in PHP
array_intersect_assoc() என்பது ஒரு array-வை எடுத்து ஒன்று அல்லது அதற்கு மேற்பட்ட வேறு array-க்களோடு compare செய்யும்போது முதல் array-வில் உள்ள ஒரு element-ன் key மற்றும் value வேறு எந்த array-விழும் பொருந்தி இருந்தால், அந்த key மற்றும் value நமக்கு விடையாக கிடைக்கும்.
array_intersect_assoc(array1, array2, array3, ...)
Example
<?php
$vegetables1 = array("a"=>"Potato","b"=>"Tomato","c"=>"Brinjal","d"=>"Cabbage");
$vegetables2 = array("a"=>"Potato","b"=>"Onion","d" =>"Cabbage");
print_r(array_intersect_assoc($vegetables1,$vegetables2));
?>
மேலே உள்ள example-ஐ கவனிக்கவும்,$vegetables1 array-வில் உள்ள key மற்றும் value a => Potato,d => Cabbage, $vegetables2 array-வில் உள்ள key மற்றும் value a => Potato,d => Cabbage உடன் பொருந்தியுள்ளது. ஆகையால் நமக்கு $vegetables1 array-வில் உள்ள b => Tomato,c => Brinjal என்ற key மற்றும் value-மட்டும் விடுத்து,$vegetables1 என்ற array-ல் உள்ள a => Potato,d => Cabbage இவை மட்டும் நமக்கு result-ஆக கிடைத்துள்ளது.
Array
(
[a] => Potato
[d] => Cabbage
)