Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php replace spaces with dash

str_replace(' ', '-', $string);
Comment

php replace space with dash

<?php 
  $string = "hello php";
  $replace = str_replace(" ", "_", $string);
  echo $replace; // hello_php
?>
Comment

php replace all spaces with dashes

// Clean up multiple dashes or whitespaces
$string = preg_replace("/[s-]+/", " ", $string);
// Convert whitespaces and underscore to dash
$string = preg_replace("/[s_]/", "-", $string);
Comment

PREVIOUS NEXT
Code Example
Php :: string contains string laravel 
Php :: laravel model string primary key 
Php :: how to count string characters in php 
Php :: pi() in php 
Php :: hide php extension in url 
Php :: enie letter validation laravel regex 
Php :: fix to 2 decimal places php 
Php :: row count in codeigniter 
Php :: wordpress change site address 
Php :: laravel hash::check 
Php :: wp get all post categories 
Php :: random color php 
Php :: php round down 
Php :: beaver builder shortcode post title 
Php :: create unique filename php 
Php :: php artisan serve not working 
Php :: write to file laravel 
Php :: install php 7.3 on amazon linux 2 
Php :: laravel insert 
Php :: PHP extension simplexml 
Php :: old value in laravel 
Php :: last login date time in wordpress 
Php :: log laravel 
Php :: check if number is float in php 
Php :: php mysql create table 
Php :: laravel password verification 
Php :: laravel any error 
Php :: php exit foreach 
Php :: wp safe redirect 
Php :: get hours difference between two dates in php 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =