开发者

Can PHP be more like python? [duplicate]

开发者 https://www.devze.com 2023-01-18 19:10 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: Does PHP have an equivalent to Python's list com开发者_如何学编程prehension syntax?
This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Does PHP have an equivalent to Python's list com开发者_如何学编程prehension 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?


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


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


$a = range(1,19);
0

精彩评论

暂无评论...
验证码 换一张
取 消