<?php $key = ' '; // imagine the content of this $key is $newKey = trim($key, chr(0xC2).chr(0xA0)); if ($newKey === '') { echo 'it\'s empty'; }
How to Trim with PHP
1K
3 years ago
0 comments
In this short snippet you will learn how to trim using trim() function. To do that you can simply use the trim and the pass in the string to trim as the 1st parameter and 2nd parameter the special character to trim. In this case, it would be "chr(0xC2).chr(0xA0)". For the code implementation do refer to the code example below.
Topics:
Frontend
Resource
Average
Average
Support Us
If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️
Leave a reply