If you want optimization, you can use array_map php function which is faster than foreach ;)