Mega Code Archive

 
Categories / Php / Data Type
 

One-based array index

<html>  <head>   <title>One-based array index</title>  </head>  <body>   <ol>   <?php   $arr = array( 1 => "1st", "2nd", "3rd", "4th", "5th" );      for( $i = 1; $i <= sizeof($arr); $i++ )   {     echo("Position $i - Element value: $arr[$i]<br>");   }   ?>   </ol>  </body> </html>