jeudi 28 janvier 2021

php strlen returning incorrect values

I'm using laravel 5.7, and i decided to play with some strings, here comes my problem, basically, my code in my controller goes like this.

$from = strlen($request->from);

$to  = strlen($request->to);
  
return array('from_len' => $from, 'to_len'=>$to);

what I'm sending in postman is like this

"direction" : true,
"to" : "",
"from" : "‬"

and what return is this

{
 "from_len": 3,
 "to_len": 0
}

So yeah i don't understand what is happening.

Thanks in advance for your attention people.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire