trim()
functionYou can use the PHP trim()
function to remove whitespace including non-breaking spaces, newlines, and tabs from the beginning and end of the string. It will not remove whitespace that occurs in the middle of the string. Let's take a look at an example to understand how it basically works:
<?php
$my_str = ' Welcome to Tutorial Republic ';
echo strlen($my_str); // Outputs: 33
$trimmed_str = trim($my_str);
echo strlen($trimmed_str); // Outputs: 28
?>
i hope it can help a lot.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Create FTP Client and Connect to Server in Cpanel
cPanel is a web hosting control panel so...Automatically Adjust iFrame Height According to its Contents Using JavaScript
Use the contentWindow Property...Laravel 7 - Column sorting with pagination example
In this article, I will share with you h...How to get the Client IP Address in PHP
When working in one of my project, I wan...Laravel 8 Load More Data on Page Scroll using Jquery Ajax
You have already known about Twitter and...