I have a problem with arrays.
On an old server all the data in arrays were with good types: a string was a string, a bool was a bool and an int was an int.
Now after a server change, all array values are "casting" to string. I cannot compare them with ===
against my integers because they are "string"
This is how it looks with laravel
dd on the old server, versus the new one .
Is there any php setting that causes this that should be fixed?
Looking at the screenshots it looks like the following is happening.
Database
Maybe some framework is updated and using json_encode/json_decode with/without this param. This will result in integer values as strings.
echo json_encode(array('event_id' => '603'));
echo json_encode(array('event_id' => '603'), JSON_NUMERIC_CHECK);
//and the output:
{"event_id":"603"}
{"event_id":603}
On laravel, you could just cast the string to become integer. For example:
return (int)$your_variable->your_column
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.