hello everyone, what is the way to replace Spaces With + icon using PHP. Suppose some text like "I Love PHP" will automatically converted like this way "I+Love+PHP" .. assuming a field has this text in a variable like> $text = I Love PHP so this variables text spaces will be replace with a + sign in a new variable like this> $text_plus=I+Love+PHP how to do it with PHP?
Thanks

Recommended Answers

Hello,
Try this script:

<?php
$text = "I Love PHP";
$text_plus = str_replace(" ", "+", $text);
echo $text_plus;
?>

Jump to Post

All 2 Replies

Hello,
Try this script:

<?php
$text = "I Love PHP";
$text_plus = str_replace(" ", "+", $text);
echo $text_plus;
?>

thanks , it works :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.