function update to meet the php older version