Page 1 of 1

References in PHP vs. pointers in C?

Posted: Mon Nov 17, 2003 5:42 am
by LonelyProgrammer
What are the differences, and similiarites, in terms of usage and theory, between PHP's references and C's pointers?

Many thanks in advance!

Posted: Mon Nov 17, 2003 5:50 am
by infolock
well, for one, you have to load specific libraries when you are gonna use different types of functions in c. in php, you just have to call the functions.

php is basically c with a coding interface like that of delphi or visual basic. i'm not saying the language itself is anything LIKE those 2, but the way it can call functions on the fly without having to call related classes or libraries is where the only similarities occurr (unless, of course, the functions you call have been custom built by yourself i)


if that's not the answer you are looking for, sorry. had to take my contacts out to rest my eyes for a while... and having a -9,-11 vision doens't help.

Posted: Mon Nov 17, 2003 8:48 am
by Stoker
a major difference is that a reference in PHP just references (points) to another assigned variable! (In C and Delphi etc a pointer references a memory location and can get lost).
In PHP Passing by reference is most useful when giving a function/method a piece of data to work with and change, I don't see any similarity to e.g. the way you can chain data/records in Pascal..