list() function is used to assign values to a list of variable in one operation
syntaxlist(var1,var2,...)
<?php $sum=array("india","pak"); list($a,$b)=$sum; echo "we are ,a $a,amd $b"; ?> |
we are a india and pak
>
list() function is used to assign values to a list of variable in one operation
syntax<?php $sum=array("india","pak"); list($a,$b)=$sum; echo "we are ,a $a,amd $b"; ?> |
ksort() function sorts an array by the keys.The values keep their original keys
syntax<?php $sum=array(a=>"india",b=>"pak"); ksort($sum); print_r($sum); ?> |
in_array() function searched an array for a specific value.This function returns TRUE if the value is found in the array or FALSE otherwise.
syntax
in_array(search,array,type)
<?php $sum=array("india","pak"); if(in_array("india",$sum) { echo"Match Found" } echo"Not found"; } ?> |
count() function counts the element of an array,of the properties or two properties of an array.
Syntax
count(array1,array2)
Example
<?php $sum=array("india","pak"); // count the elements of an array echo count($sum); ?> |
<?php $sum=array("india","pak"); array_push($arr,"usa","uk"); print_r($sum); ?> |