Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP - Check how many values in array

Tags:

arrays

php

Can I check the number of values in an array, for example...

$abc=array();

$abc[0]="asd";
$abc[1]="sadaf";
$abc[2]="sfadaf";

I want to check and store it(2) in a variable that array abc[] exists till $abc[2]..

Thanks

like image 400
halocursed Avatar asked Dec 18 '25 02:12

halocursed


1 Answers

Use count or sizeof for the total number of values or array_count_values to count the frequency of each value.

like image 65
Gumbo Avatar answered Dec 20 '25 16:12

Gumbo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!