Jump to content
  • Advertisement
Sign in to follow this  
CProgrammer

php array questions

This topic is 3828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I do most of my developing in C++ so I have a quick question on php. It seems arrays in php are basically maps. Is there a way to have a standard array that is stored linearly in memory? Also are arrays passed by value or pointer or reference when passed to functions in php 5? Does adding the array keyword chang anything? -CPrgrammer

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by CProgrammer
Hi guys,

I do most of my developing in C++ so I have a quick question on php. It seems arrays in php are basically maps. Is there a way to have a standard array that is stored linearly in memory?


No, all arrays in PHP are effectively maps. You can of course use them as straight zero-based numerically-indexed arrays.

Quote:
Also are arrays passed by value or pointer or reference when passed to functions in php 5?


They behave as if passed by value. I believe they are actually passed by reference with a copy-on-write mechanic though.

Quote:
Does adding the array keyword chang anything?


It forces the argument to be an array, but that's it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!