Without looking at the code: If you want to intval an array it's easier to use array_map