mardi 28 août 2018

check the part of the substring in string

I want to check the given word is a substring of string in laravel view page .I want to check 700 is part of a string 387,700.I have a value $user->approver_id is 387,700 and Auth::User()->id is 700 in view page.I have tried with sample php code

if(strpos($user->approver_id,Auth::User()->id)!== false),returns true in php but returns false in laravel view page.how to get same as php in larevel view page

<?php
 $a = '387,700';
  if (strpos($a, '700') !== false) {
   echo 'true';
 } 

?>

output is true, thus working perfectly

My laravel page code :

if(strpos($user->approver_id,Auth::User()->id)!== false){
  echo 'true';
}
else{
  echo 'false';
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire