PHP Classes

pointers

Recommend this page to a friend!

      PHP Classes blog  >  6 Reasons Why PHP is ...  >  All threads  >  pointers  >  (Un) Subscribe thread alerts  
Subject:pointers
Summary:php
Messages:2
Author:Frederik Yssing
Date:2013-02-18 21:02:47
Update:2013-02-18 23:19:52
 

  1. pointers   Reply   Report abuse  
Picture of Frederik Yssing Frederik Yssing - 2013-02-18 22:42:30
Great article, I like how the languages are compared to LOTR.

I only wish that c++ was as elegant as php, and I do thank the creator of php, that they did not implement pointers.

  2. Re: pointers   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-02-18 23:19:52 - In reply to message 1 from Frederik Yssing
Well, PHP does not have pointers as in C/C++ but you have references. You can pass a variable by reference to a function. That is a sort of pointer.

But I guess I understand what you mean, not having to explicitly allocate memory to store the values of variables and then having to free that memory when it is no longer in use.

PHP uses a sort of garbage collection that allows it to automatically allocate and free memory for variables for you.

On the down side PHP does not support real local variables that are just space in the local stack instead of being allocated from the heap. It is just a minor inconvenience that can make it a bit slower.