current() function in PHP || PHP Current Function

current() function in php

Last Updated by Pooja Chikara

0 2386

PHP current() function is used to return the value corresponding to the current pointer of a PHP array. It is an inbuilt function of PHP.

Syntax:

current($array);

here,

$array is a PHP array.


Example:

<?php
$arr1 = array("apple","orange","banana","fig",);
$current_value=current($arr1); // it will return value corresponding to the current pointer i.e. apple
echo "Current value is $current_value <br>";
?>

Output:

Note: You should also read prev(), next(), end() and reset() functions.



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