php replace space with dash

Solutions on MaxInterview for php replace space with dash by the best coders in the world

showing results for - "php replace space with dash"
Aymen
05 Jan 2021
1str_replace(' ', '-', $string);
Benoit
28 Jan 2018
1<?php 
2  $string = "hello php";
3  $replace = str_replace(" ", "_", $string);
4  echo $replace; // hello_php
5?>
Mabel
18 Oct 2016
1// Clean up multiple dashes or whitespaces
2$string = preg_replace("/[\s-]+/", " ", $string);
3// Convert whitespaces and underscore to dash
4$string = preg_replace("/[\s_]/", "-", $string);
queries leading to this page
str replace space with dashphp string replace spaces with dasheslaravel replace character with dashphp remove space and hyphen from stringreplace spaces with dashes phpreplace space to dash and replce symbol php stringhow we replace space with dash in phpphp lower case and replace spacer for dashreplace first whitespace with hyphen phpphp replace space or comma with dashstring replace space with dashphp replace whitespace with dashphp str replace underscore and dash from stringreplace only first whitespace with hyphen phpreplace dash with space phplaravel check if string has spaces or dashesreplace space with dash in phpphp dash where spacereplace space or dash with plus phpreplace space with hyphen in phpphp str replace under score and dash from stringphp replace all spaces with dashes with underscorephp replace space by dashphp replace spaces with dashesphp replace all spaces with dashes with spacereplace spaces with dash phpchange space to dash phpphp replace all spaces with dashesphp replace dash with spacehow to replace space iwth dash phpphp url single dashphp replace space and dash with underscorehow to trim spaces and add dash in phpphp string replace dash with spacereplace space with dash phpphp regex replace spaces with dasehsremove underscore and desh and capital phphow to change spaces to dash in phpphp replace spacesall space replace with dash in phpreplace space in url with dash phpphp replace dashes with spacesphp change space to dashphp string replace space with dashphp replace all space with hyphenphp replace spaces with dashes in stringphp replace spaces with dashreplace all spaces with dashes phpcahnge text to small and add replace space with dash phpphp remove spaces and dashesphp replace space with dashremove dashes and spaces phpphp string regex remove spaces and dashesrepalce spaces with dash phpphp replace space with dash