Php Add To Array If Condition In Python