supertrucker Posted March 26, 2008 Share Posted March 26, 2008 Are there pointers in php? Link to comment Share on other sites More sharing options...
jhecht Posted March 26, 2008 Share Posted March 26, 2008 you mean as in memory pointers? Kind of. you put a & sign in front of the variable. function bob(&$memory){ $memory = 'Hi';}$var = array('one','two');var_dump($var);bob($memory);var_dump($var); Link to comment Share on other sites More sharing options...
supertrucker Posted March 26, 2008 Author Share Posted March 26, 2008 Perfect, thank you! Here's the function I needed it for, to post what could be an unset variable back to a form:function ghostw(&$v){ if (isset($v)) { echo $v; }else { $v='';}} Link to comment Share on other sites More sharing options...
jeffg Posted March 26, 2008 Share Posted March 26, 2008 Strictly speaking, there is a difference between pointers and passing by reference... Link to comment Share on other sites More sharing options...
justsomeguy Posted March 26, 2008 Share Posted March 26, 2008 Yes, PHP does not have C-style pointers, and the references in PHP don't even reference memory, they reference an entry in a symbol table built by PHP. So PHP has references, but not like C, and not pointers. Link to comment Share on other sites More sharing options...
supertrucker Posted March 26, 2008 Author Share Posted March 26, 2008 Yes, PHP does not have C-style pointers, and the references in PHP don't even reference memory, they reference an entry in a symbol table built by PHP. So PHP has references, but not like C, and not pointers.Well in anycase, thanks for the help, as it did exactly what I needed it to! I don't even know how to use C style pointers, but I am familiar with them from programming a little in Pascal. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.