pos() function in PHP || PHP Pos Function

pos() function in php

Last Updated by Pooja Chikara

0 2215

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:




Best WordPress Hosting


Share:

SSL for business, from $12.88


Leave a Reply


Comments
    Waiting for your comments

Coding Tag WhatsApp Chat
Coding Tag WhatsApp Chat