Showing posts with label php array element. Show all posts
Showing posts with label php array element. Show all posts
Count php array element
Posted by Raj
Count php array element
count : Count all elements in an array.
Syntax
count(array)
Example:
<?php
$arr1 = array('A','B');
echo count($arr1);
?>
Output:
2
count : Count all elements in an array.
Syntax
count(array)
Example:
<?php
$arr1 = array('A','B');
echo count($arr1);
?>
Output:
2
PHP array Functions
Posted by Raj
PHP array Functions
array()
array_change_key_case()
array_chunk()
array_combine()
array_count_values()
array_diff()
array_diff_assoc()
array_diff_key()
array_diff_uassoc()
array_diff_ukey()
array_fill()
array_filter()
array_flip()
array_intersect()
array_intersect_assoc()
array_intersect_key()
array_intersect_uassoc()
array_intersect_ukey()
array_key_exists()
array_keys()
array_map()
array_merge()
array_merge_recursive()
array_multisort()
array_pad()
array_pop()
array_product()
array_push()
array_rand()
array_reduce()
array_reverse()
array_search()
array_shift()
array_slice()
array_splice()
array_sum()
array_udiff()
array_udiff_assoc()
array_udiff_uassoc()
array_uintersect()
array_uintersect_assoc()
array_uintersect_uassoc()
array_unique()
array_unshift()
array_values()
array_walk()
array_walk_recursive()
arsort()
asort()
compact()
count()
current()
each()
end()
extract()
in_array()
key()
krsort()
ksort()
list()
natcasesort()
natsort()
next()
pos()
prev()
range()
reset()
rsort()
shuffle()
sizeof()
sort()
uasort()
uksort()
usort()
array()
array_change_key_case()
array_chunk()
array_combine()
array_count_values()
array_diff()
array_diff_assoc()
array_diff_key()
array_diff_uassoc()
array_diff_ukey()
array_fill()
array_filter()
array_flip()
array_intersect()
array_intersect_assoc()
array_intersect_key()
array_intersect_uassoc()
array_intersect_ukey()
array_key_exists()
array_keys()
array_map()
array_merge()
array_merge_recursive()
array_multisort()
array_pad()
array_pop()
array_product()
array_push()
array_rand()
array_reduce()
array_reverse()
array_search()
array_shift()
array_slice()
array_splice()
array_sum()
array_udiff()
array_udiff_assoc()
array_udiff_uassoc()
array_uintersect()
array_uintersect_assoc()
array_uintersect_uassoc()
array_unique()
array_unshift()
array_values()
array_walk()
array_walk_recursive()
arsort()
asort()
compact()
count()
current()
each()
end()
extract()
in_array()
key()
krsort()
ksort()
list()
natcasesort()
natsort()
next()
pos()
prev()
range()
reset()
rsort()
shuffle()
sizeof()
sort()
uasort()
uksort()
usort()
in_array :php find in array
Posted by Raj
in_array :php find in array
PHP in_array is used to check if a value exists in an array
Syntax:
bool in_array($var,$arr)
Returns TRUE if $var exists in an array, FALSE otherwise.
Example:php find in array
<?php
$arr1 = array('A','B');
if(in_array('A',$arr1))
echo '`A` exists in an array'
else
echo 'Not Found';
?>
Output :
Array.
PHP in_array is used to check if a value exists in an array
Syntax:
bool in_array($var,$arr)
Returns TRUE if $var exists in an array, FALSE otherwise.
Example:php find in array
<?php
$arr1 = array('A','B');
if(in_array('A',$arr1))
echo '`A` exists in an array'
else
echo 'Not Found';
?>
Output :
Array.
is_array : PHP array function
Posted by Raj
is_array : PHP array function
PHP is_array is used to find whether a variable is an array or not.
Syntax:
bool is_array($arr)
Returns TRUE if $arr is an array, FALSE otherwise.
Example: php is array
<?php
$arr1 = array('A','B');
if(is_array($arr1))
echo 'Array'
else
echo 'Not an Array';
?>
Output :
Array.
PHP is_array is used to find whether a variable is an array or not.
Syntax:
bool is_array($arr)
Returns TRUE if $arr is an array, FALSE otherwise.
Example: php is array
<?php
$arr1 = array('A','B');
if(is_array($arr1))
echo 'Array'
else
echo 'Not an Array';
?>
Output :
Array.