PHP types for kids ... part 3: type strictly and cast before iterating
Normalize data at the boundary ... not inside the loop. The series' core rule: why it pays to cast a collection once, so you don't have to probe the behavior of every child node.
Read article →