string with a spaces

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nnn
Forum Newbie
Posts: 3
Joined: Fri Oct 25, 2002 12:56 am

string with a spaces

Post by nnn »

Please,help me with my little problem:
i need to create string with a spaces(this is a line):
$line=$string1.$space.string2.$space.$string3 ...
$space=" ";
But finally in $line there are no spaces.
How can i insert spaces between strings?
If anyone could help me out that would be great!

:)
rev
Forum Commoner
Posts: 52
Joined: Wed Oct 02, 2002 3:58 pm
Location: Atlanta, GA

Post by rev »

Code: Select all

<?php
$line = $string1 . " " . $string2 . " " . $string3;
?>
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

Code: Select all

<?
$line = array($string1, $string2, $string3, $string4, $string5, $string6);
$newstring = implode(" ", $line);
?>
might be better if you have alot of strings to join.
nnn
Forum Newbie
Posts: 3
Joined: Fri Oct 25, 2002 12:56 am

Post by nnn »

Thank you very much !
:lol:
Post Reply