How to use pos in PHP

In this article, I will explain how the pos() function can be used in PHP.
  • 1407

pos() function in PHP

  • The pos() function is used to return the value of the current element in an array.
  • The pos() function is an alias of the current() function.
  • The pos() function returns FALSE on empty elements.

Syntax

pos(array)

Parameter

  • array array is required parameter. it is the input array to use.

Example

The following example show to how the pos() function can be used in PHP.

<html>

<body>

<h3 style="color: grey;">pos() function example in PHP</h3>

    <?php 

    $subject_array= array('Hindi','English','Math','Science'); 

    $result = pos($subject_array); 

    echo "Current element of an array : ". $result; 

    ?> 

</body>

</html>

 

Output

posphp.jpg
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.