Search
 
SCRIPT & CODE EXAMPLE
 

PHP

remove space from string php

<?php
$stripped = str_replace(' ', '', "10 1000 0000 000");
echo $stripped;
Comment

remove spaces from string php

<?php
$phone = preg_replace( '/s+/', '', "01234 567890" );
echo $phone;
Comment

remove all spaces php

$string = "this is my     string";
$string = preg_replace('/s+/', '', $string);
Comment

remove whitespace from string php

$str = "


Hello World!


";
echo "With trim: " . trim($str);
Comment

Remove All Spaces Out of a String in PHP

phpCopy<?php 
$searchString = " ";
$replaceString = "";
$originalString = "This is a programming tutorial"; 
 
$outputString = preg_replace('/s+/', '', $originalString); 
echo("The original string is: $originalString 
");  
echo("The string without spaces is: $outputString 
"); 
?> 
Comment

php remove space from string

<?php
$name = "Yeasin_ahammed_apon"
#str_replace('what u want to replace', 'with what ', $name);
str_replace('_', ' ', $name);
echo $name;
# output: Yeasin ahammed apon
?>
#str_replace('what u want to replace', 'with what ', $name);
Comment

removed spacel caracter using php

<?php
$string = "DelftStack is a best platform.....";
echo "Output:  " . rtrim($string, ".");
?>
  Output: DelftStack is a best platform
Comment

Remove All Spaces Out of a String in PHP

phpCopy<?php 
$searchString = " ";
$replaceString = "";
$originalString = "This is a programming tutorial"; 
 
$outputString = str_replace($searchString, $replaceString, $originalString); 
echo("The original string is: $originalString 
");  
echo("The string without spaces is: $outputString"); 
  
?> 
Comment

removed spacel caracter using php

<?php
$mainstr = "@@PHP@Programming!!!.";
echo "Text before remove:
" . $mainstr;
echo "

Text after remove: 
" . trim($mainstr, '@!.');
?>
Comment

removed spacel caracter using php

<?php
$mainstr = "<h2>Welcome to <b>PHPWorld</b></h2>";

echo "Text before remove: 
" . $mainstr;

echo "

Text after remove: 
" .
    str_ireplace(array('&lt;b&gt;', '&lt;/b&gt;', '&lt;h2&gt;', '&lt;/h2&gt;'), '',
    htmlspecialchars($mainstr));
?>
 output: 
  Text before remove: 
<h2>Welcome to <b>PHPWorld</b></h2>

Text after remove: 
Welcome to PHPWorld
Comment

removed spacel caracter using php

<?php
$strTemplate = "My name is :name, not :name2.";
$strParams = [
    ':name' => 'Dave',
    'Dave' => ':name2 or :password',
    ':name2' => 'Steve',
    ':pass' => '7hf2348', ];
echo "
" . strtr($strTemplate, $strParams) . "
";
echo "
" . str_replace(array_keys($strParams), array_values($strParams), $strTemplate) . "
";


?>
  Output:

My name is Dave, not Steve.
My name is Steve or 7hf2348word, not Steve or 7hf2348word2.
Comment

PREVIOUS NEXT
Code Example
Php :: php Error!: could not find driver 
Php :: php client enable short tags 
Php :: php 6 digit random number 
Php :: get base url in magento 2 
Php :: wordpress get category page title 
Php :: send email when form is submitted php 
Php :: php return loading message 
Php :: how to delete a file in laravel 
Php :: mobile number validation in laravel 8 
Php :: laravel send post request from controller 
Php :: regex phpstorm 
Php :: laravel run local to all land networks 
Php :: php preg_replace whitespace 
Php :: laravel carbon first day of month 
Php :: php remove notice session already been started 
Php :: laravel get input from request 
Php :: php is day light saving time 
Php :: validate executable path vscode 
Php :: get current year php 
Php :: convert comma separated number to number in php 
Php :: php string to char array 
Php :: Get Parameters From a URL String in PHP 
Php :: swich in php 
Php :: php inline if null check 
Php :: tackle discount in php laravel blade 
Php :: How to send data from PHP to Python 
Php :: set image asset path in laravel 
Php :: start php session 
Php :: how to delete all data from table in php 
Php :: toaster message in laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =