Search
 
SCRIPT & CODE EXAMPLE
 

PHP

remove space from string php

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

php remove space before and after string

$words = '      my words     ';
$words = trim($words);
var_dump($words);
// string(8) "my words"
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 all whitespace from a string

//remove all white spaces from a string
$whatonearth=preg_replace('/s/','',"what o n   ear th");
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 :: laravel eloquent without relation 
Php :: every wordpress page redirect to localhost ? 
Php :: wordpress get order 
Php :: Artisan command on live server 
Php :: how to create slug in laravel 
Php :: php read csv 
Php :: laravel drop foreign key 
Php :: custom laravel auth 
Php :: join table laravel count 
Php :: blade if array key exists 
Php :: rand string php 
Php :: check method in laravel 
Php :: php get file location 
Php :: contains php 
Php :: laravel 8 eloquent orderby 
Php :: get age in months php 
Php :: php rand vs mt_rand 
Php :: laravel multiple group by 
Php :: check if not empty blade engine 
Php :: laravel add user 
Php :: name of today php 
Php :: base url dinamis codeigniter 
Php :: laravel add column to table 
Php :: laravel log 
Php :: pagination php mysql 
Php :: get current authenticated user laravel 
Php :: laravel pagination vuetify 
Php :: display image in php from folder 
Php :: wordpress create shortcode 
Php :: laravel append parameter to links 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =