Answers for "replace hyphen with space php"

PHP
1

php replace space with dash

<?php 
  $string = "hello php";
  $replace = str_replace(" ", "_", $string);
  echo $replace; // hello_php
?>
Posted by: Guest on June-18-2021
0

php insert hyphen into spaces in string

$test = "jjfnj 948";
$test = str_replace(" ", "", $test);  // strip all spaces from string
echo substr($test, 0, 3)."-".substr($test, 3);  // isolate first three chars, add hyphen, and concat all characters after the first three
Posted by: Guest on October-17-2020

Code answers related to "replace hyphen with space php"

Browse Popular Code Answers by Language