Pointers in PHP

Pointers are used to find the Memory address of the variables in Php. Pointers are also variables that hold the memory address instead of values. In Programming and complex Data Structures Pointers are used to Pass Value by Reference.


Source Code 


<html>
 <head>
  <title>Pointers in Php</title>
 </head>
 <body>
 <?php // Pointers and while loops revisited
 
  $Numbers = array(1, 2, 3, 6, 12, 23);
 ?>
 <?php
  echo "1: " . current($Numbers) . "<br />";
  next($Numbers);
  echo "2: " . current($Numbers) . "<br />";
  reset($Numbers);
  echo "3: " . current($Numbers) . "<br />";
 ?>
 <br />
 <?php
   while ($age = current($Numbers)) {
   echo $age . ", ";
   next($Numbers);
  }
 ?>
 </body>
</html>

Output of the Program 

Pointers in Php


Share on Google Plus

About Asad

Asad Niazi is Software Engineer , Programmer, Web Developer and a young mentor of BloggersTown and PProgramming. Asad Love to writes about Technology, Programming, Blogging and make money online.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment