Alternative version for the foreach php to use a scalar