How check memory location of variable in php?

前端 未结 6 1168
旧时难觅i
旧时难觅i 2020-12-06 10:05

How check memory location of variable in php?

Thanks

6条回答
  •  时光取名叫无心
    2020-12-06 10:34

    I'm fairly certain this isn't possible in PHP. You might be able to create an extension to do this, but I can't see any use for it. Memory addresses are useless within PHP scripts since the interpreter handles all the internal variable works. Outside of PHP (say manipulating a memory address with C or C++) would be dangerous to say the least. I would expect you could crash a script and possibly your interpreter if you modified a memory address used by a PHP script while it was executing.
    If you are looking for internal pointers in PHP, though, take a look into references. It might take a few reads to wrap your head around them, but if you need to pass by reference, look into them. Quick example:

    
    

提交回复
热议问题