# How to get the first element of an array in PHP?

To get the first element of an array in PHP, the code is as follows −

## Example

Live Demo

<?php
$arr = array( "p"=>"150", "q"=>"100", "r"=>"120", "s"=>"110", "t"=>"115", "u"=>"103", "v"=>"105", "w"=>"125" ); echo "Array value ..."; echo "Value 1 = " .$arr["p"], "";
?>

## Output

This will produce the following output−

Array value ...
Value 1 = 150

## Example

Let us now see another example −

Live Demo

<?php
$arr = array( "p"=>"150", "q"=>"100", "r"=>"120", "s"=>"110", "t"=>"115", "u"=>"103", "v"=>"105", "w"=>"125" ); echo "Value 1 = " .reset($arr);
?>

## Output

This will produce the following output −

Value 1 = 150