Python has syntactically sweet list comprehensions:
S = [x**2 for x in range(10)] print S; [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
In PHP I wo
PHP 5.5 may support list comprehensions - see the mailing list announcement:
And further discussion: