@searcherforthetrueth Since you are using == instead of ===, PHP will automatically convert the type of the second value as necessary for comparison. What you are doing is fine.
Sign up to request clarification or add additional context in comments.
2 Comments
user8554313
user8554313
Thank you, maybe is there another elegant way with a trick with php standard function something like compare('int', value1, value2)- maybe do you know function like array_reduce or something like these fictional examples for correct comparing two values?
if(if ($a['id'] == (int)$b['id']) {}==instead of===, PHP will automatically convert the type of the second value as necessary for comparison. What you are doing is fine.