Jump to content

String to URI Format


ShoeLace1291

Recommended Posts

Here is some example code I wrote using an array to do this job for you. You can process your strings in various ways, but this will produce the desired result:

 

<?php
$search = array(' ');
$replace = array('-');
$subject = 'This is a string with spaces between each word.';
echo str_replace($search, $replace, $subject);
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.