How to use pos in PHP
In this article, I will explain how the pos() function can be used in PHP.
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
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
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