PHPUnit API reference
- version 3.6
Check those constraints:
This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)
The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as
array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the
array part of it away. So how does that work?
The key here is that objects usually have a predefined set of keys, whereas arrays don't:
In the comments from my last post and on Twitter I noticed a lot of people who had something to say about PHP. The comments were varied but they usally sounded something like this (sorry @ipetepete, I picked yours because it was the shortest).
...the little bits of soul from all of us who've had to work on, and or maintain large PHP applications. – ipetepete
In Pete's defense, he did go on to say that rest of the stack I was using was a "smorgasbord of awesome". Thanks, Pete. I agree!
I would, however, like to take a little time to correct a misperception in the developer community about PHP. I recently got into this same... discussion... with Jeff Atwood, and I seem to be running into it more and more. So here goes. Please bear with me as I cover a little history further on.
Pete, and everybody else, _you're exactly rig
This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.
Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.
|# git-mv-with-history -- move/rename file or folder, with history.|
|# Moving a file in git doesn't track history, so the purpose of this|
|# utility is best explained from the kernel wiki:|
|# Git has a rename command git mv, but that is just for convenience.|
|# The effect is indistinguishable from removing the file and adding another|
|# with different name and the same content.|