New Tips In Laravel

mask() – before() – after()

use Illuminate\Support\Str;

$str = ‘marcosgaad@gmail.com’;
Str::mask($str, ‘*’, 4); // marc****************
Str::mask($str, ‘*’, 4, 3); // marc***aad@gmail.com
Str::mask($str, ‘*’, -4); // marcosgaad@gmail****
Str::mask(…


This content originally appeared on DEV Community and was authored by Marcos Gad

mask() - before() - after()

use Illuminate\Support\Str;

$str = 'marcosgaad@gmail.com';
Str::mask($str, '*', 4); // marc****************
Str::mask($str, '*', 4, 3); // marc***aad@gmail.com
Str::mask($str, '*', -4); // marcosgaad@gmail****
Str::mask($str, '*', -4, 3); // marcosgaad@gmail***m

$before = Str::before($str, '@'); // marcosgaad
Str::mask($before, '*', 0) . '@' . Str::after($str, '@'); // **********@gmail.com

I hope you enjoy the code.


This content originally appeared on DEV Community and was authored by Marcos Gad


Print Share Comment Cite Upload Translate Updates
APA

Marcos Gad | Sciencx (2021-11-18T09:14:46+00:00) New Tips In Laravel. Retrieved from https://www.scien.cx/2021/11/18/new-tips-in-laravel/

MLA
" » New Tips In Laravel." Marcos Gad | Sciencx - Thursday November 18, 2021, https://www.scien.cx/2021/11/18/new-tips-in-laravel/
HARVARD
Marcos Gad | Sciencx Thursday November 18, 2021 » New Tips In Laravel., viewed ,<https://www.scien.cx/2021/11/18/new-tips-in-laravel/>
VANCOUVER
Marcos Gad | Sciencx - » New Tips In Laravel. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/18/new-tips-in-laravel/
CHICAGO
" » New Tips In Laravel." Marcos Gad | Sciencx - Accessed . https://www.scien.cx/2021/11/18/new-tips-in-laravel/
IEEE
" » New Tips In Laravel." Marcos Gad | Sciencx [Online]. Available: https://www.scien.cx/2021/11/18/new-tips-in-laravel/. [Accessed: ]
rf:citation
» New Tips In Laravel | Marcos Gad | Sciencx | https://www.scien.cx/2021/11/18/new-tips-in-laravel/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.