In this tutorial you will learn about the Laravel str isAscii() function Example and its application with practical example.
In this article, I’ll show you how to use laravel isAscii() function with example. We will show example of laravel isAscii() function in laravel. In this tutorial, we will check if a test string is valid 7 bit ASCII.
Laravel isAscii() function
The Str::isAscii method to determines if a given string is 7 bit ASCII.
Example:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\FileController; use Illuminate\Support\Str; class HomeController extends Controller { /** * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { $isAscii1 = Str::isAscii('test'); dd($isAscii1); // output - true $isAscii2 = Str::isAscii('ü');; dd($isAscii2); // output - false } } |
Output:-
1 2 |
true false |