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 harsukh21@gmail.com
How to Create a Custom Artisan Command in Laravel 8
As we know, Laravel provides artisan com...How to Convert HTML to pdf in Python
Hello guys, In this article, we will...HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
in this article, I will share with you h...How to Store Multiple Checkbox Value in Database in Laravel 8
In this article i will share with you ho...How To Save Multiple Checkboxes Values in React js
In this tutorial, we will optically disc...