functional php : fix foreach syntax