jeudi 23 janvier 2020

PHP/Laravel casting and rounding string to int

I'm sending a POST request to my Laravel controller with a STRING variable "tweetId" (looks like this "1143910903294898176").
The problem is that the controller is casting the variable to an int and rounding the number (it ends up like this 1143910903294898200). I'm not sure if its a PHP or a Laravel issue.
The weird thing is that if i do dd($request), the variable is still the original string, but if i do $request->tweet_id then i get the rounded int.

public function store(Request $request)
{
    return $request->input('tweet_id');
}



Aucun commentaire:

Enregistrer un commentaire