PHP

PHP Menu

PHP

pos() Function - Definition, Syntax, Parameters, Examples

Definition

The pos() function returns the value of the current element in an array(alias of current() function).

Syntax

pos(array)

Parameters

Parameter Description
array Required. Specifies the array to use.

Example

<?php
// Example 1 $cities = array("New York", "London", "Tokyo", "Berlin", "Cairo"); echo pos($cities) . "<br>";
// Examples in conjunction with other related functions echo pos($cities) . "<br>"; echo next($cities) . "<br>"; echo pos($cities) . "<br>"; echo end($cities) . "<br>"; echo pos($cities) . "<br>"; echo prev($cities) . "<br>"; echo pos($cities) . "<br>"; echo reset($cities) . "<br>"; echo pos($cities) . "<br>";

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods