It computes the difference of arrays with additional index check
Example
<?php
echo “<pre>”;
$array1 = array(“a” => “PHP”, “b” => “JSP”, “c” => “ASP”, “red”);
$array2 = array(“a” => “green”, “yellow”, “red”);
$array3 = array_diff_assoc($array1, $array2);
print_r($array3);
?>
Output
Array
(
[a] => PHP
[b] => JSP
[c] => ASP
[0] => red
)
It counts all the values of an array
Example
<?php
echo “<pre>”;
$array = array(PHP, “ASP”, PHP, “ASP”, “PHP”);
print_r(array_count_values($array));
?>
Output
Array
(
[PHP] => 3
[ASP] => 2
)
It creates an array by using one array for keys and another for its values
Example
<?php
echo “<pre>”;
$array1 = array(‘PHP’, ‘ASP’, ‘JSP’);
$array2 = array(‘Javascript’, ‘VBScript’, ‘ActionScript’);
$array3 = array_combine($array1, $array2);
print_r($array3);
?>
Output
Array
(
[PHP] => Javascript
[ASP] => VBScript
[JSP] => ActionScript
)
It splits an array into chunks
Example
<?php
echo “<pre>”;
$array = array(‘a’, ‘b’, ‘c’, ‘d’, ‘e’);
print_r(array_chunk($array, 3));
?>
Output
Array
(
[0] => Array
(
[0] => a
[1] => b
[2] => c
)
[1] => Array
(
[0] => d
[1] => e
)
)
It converts the keys of an array into uppercase
Example
<?php
echo “<pre>”;
$array = array(“FirSt” => 17, “SecOnd” => 7);
print_r(array_change_key_case($array, CASE_UPPER));
?>
Output
Array
(
[FIRST] => 17
[SECOND] => 7
)
It returns hyperbolic tangent
Example
<?php
echo tanh(45);
?>
Output
1
It returns tangent value
Example
<?php
echo tan(45);
?>
Output
1.6197751905439
It seed the random number generator
Example
<?php
srand(mktime());
echo(rand());
?>
Output
675098144
It returns Square root
Example
<?php
echo sqrt(16);
?>
Output
4
it returns hyperbolic sine
Example
<?php
echo sinh(17.7);
?>
Output
24321050.753167
Zend | Magento Certified PHP | eCommerce Architect