• PHP Video Tutorials

PHP - Function pos()



Syntax

pos ( $array );

Definition and Usage

The pos() function is an alias of current() function and simply returns the value of the array element that's currently being pointed to by the internal pointer. It does not move the pointer in any way. If the internal pointer points beyond the end of the elements list, post() returns FALSE.

Parameters

Sr.No Parameter & Description
1

array(Required)

It specifies an array

Return Value

It returns the current element in an array.

Example

Try out following example −

<?php
   $input = array('foot', 'bike', 'car', 'plane');
   $mode = pos($input); 
   print "$mode <br />";
?> 

This will produce the following result −

foot
php_function_reference.htm
Advertisements