-
Website
http://interfacelab.com -
Original page
http://interfacelab.com/metadataattributes-in-php/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
Evan Courtney
1 comment · 1 points
-
smikolay
1 comment · 1 points
-
sparkletack
4 comments · 1 points
-
Andlil
1 comment · 1 points
-
rryan
1 comment · 1 points
-
-
Popular Threads
Any speed issues using this approach?
You could do the same thing using memcached, but APC's is much faster as the memory is local to its process.
Thanks for your nice post :)
What I'm more interested in is why you left c#. I'm in the same boat. At work I do c# and it's pretty damned nice. I also maintain a boatload of wordpress blogs so I have to learn PHP.
Honestly, I don't mind it, there are some benefits to it, but I do miss C# and am sort of kicking myself for not having done the rewrite in Python.
C'est la vie. :)
/**
* @someAnno(1=>2, "yeah"=> array("no","yes"))
*/
It's really too bad that the language itself doesn't support it (outside doc comments) as it would be much faster and not require the caching.
Yeah, it's unfortunate that this is really a huge hack to get a language feature that would be a nice to have.
I'm going to be re-posting a patch for PHP that enables array shortcut notation in the next couple of days. The patch was originally by Ryusuke Sekiyama, posted here: http://marc.info/?l=php-internals&m=11999597202...
Instead of using array() you can use [], eg:
$var=[1,2,3,4];
$othervar=[ 'test' => [1,2], 'sick' => [1,[3,4]]];
I've been poking around for a while now trying to figure out a way to use reflection that would be "interesting" and "innovative" I think this might be it.
The part where you said, using reflection to obtain meta data and have that information be discoverable rather than declarative...I'm not sure I agree 100% but the idea of marking my methods as REST-able (for lack of a better word) by indicating that in the comment as meta-data...
Damn thats a good idea and I owe it all to this article. :P
Cheers,
Alex