> Online tutorial

list() in php

list() function is used to assign values to a list of variable in one operation

syntax
list(var1,var2,...)


<?php

$sum=array("india","pak");
list($a,$b)=$sum;
echo "we are ,a $a,amd $b";


?>

Output

we are a india and pak

ksort() in php

ksort() function sorts an array by the keys.The values keep their original keys

syntax
ksort(array,sorttype)


<?php

$sum=array(a=>"india",b=>"pak");
ksort($sum);
print_r($sum);

?>

Output
Array(a=>india
b=>pak)

in_array() in php

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";
}

?>

Output
Match Found

count() in php

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);

?>

Output
2

array_push() in php

array_push() function inserts one or more element to the end of an array
syntax
array_push(array,val1,val2,...)


<?php

$sum=array("india","pak");
array_push($arr,"usa","uk");

print_r($sum);

?>

Output
Array([0]=>india
[1]=>pak
[2]=>usa
[3]=>uk)