tags:

views:

94

answers:

3

Possible Duplicate:
Does PHP have an equivalent to Python's list comprehension syntax?

Does PHP have any equivalent of the simple and awesome list comprehension in python? Specifically, can I do a = [x for x in xrange(1,20)] in PHP w/o annoying loops?

+2  A: 

I think this will set you free: http://code.google.com/p/php-lc/

Chris
Bandaid over a bullet hole. http://bit.ly/bM1Teu
amphetamachine
Yeah, that's kinda ugly.
Wells
A: 

Correct me if I'm wrong, but isn't the python 'x for x in xrange' a loop?

hisabness
A: 
$a = range(1,19);
konforce