pos() function in PHP || PHP Pos Function

pos() function in php

Last Updated by Pooja Chikara 25-Apr-20

0 358


PHP pos() function is used to return the current item in a PHP array. It is an inbuilt function of PHP. The working of this function is the same as the working of the current() function.

Syntax:

post($array);

here,

$array is a PHP array.


Example:

<?php
$arr1 = array("apple","orange","banana","fig",);
$c_value=pos($arr1);  // it will return the first item of array i.e. apple
echo "Current item of array is $c_value";
?>

Output:

pos() function in php


Share:


Leave a Reply


Comments
    Waiting for your comments