PHP SplFixedArray getSize() Function
The SplFixedArray::getSize() function is an inbuilt function in PHP which is used to get the size of the array.
Syntax:
int SplFixedArray::getSize()
Parameters: This function does not accept any parameter.
Return Value: This function returns the size of the array.
Below programs illustrate the SplFixedArray::getSize() function in PHP:
Program 1:
<?php
$gfg = new SplFixedArray(15);
echo $gfg ->getSize();
?>
|
Program 2:
<?php
$gfg1 = new SplFixedArray(0);
$gfg2 = new SplFixedArray(9);
$gfg3 = new SplFixedArray(100);
$gfg4 = new SplFixedArray(878);
echo $gfg1 ->getSize() . "\n" ;
echo $gfg2 ->getSize() . "\n" ;
echo $gfg3 ->getSize() . "\n" ;
echo $gfg4 ->getSize() . "\n" ;
$gfg1 ->setSize(100);
$gfg2 ->setSize(200);
echo $gfg1 ->getSize() . "\n" ;
echo $gfg2 ->getSize() . "\n" ;
?>
|
Output:
0
9
100
878
100
200
Reference:https://www.php.net/manual/en/splfixedarray.getsize.php
Last Updated :
23 Jun, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...