mercredi 14 novembre 2018

Remove String in Limit Maximum

I have a string that has 14 character "TEST,TEST,TEST"

the problem is i want to limit the string become 6 characters and store to DB

i have tried this code :

$text = "TEST,TEST,TEST";
DB::table('table')
        ->update([
            'name' => substr($text, 0, 6);
    ]);

but the result like this "TES,TE", i dont want to show last cuted character, i want to the result like this "TES"

Please help me, i have tried more way but i have not found the correct answer thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire