Connecting Tech Pros Worldwide Help | Site Map

joining string

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 01:30 PM
socialism001@yahoo.com
Guest
 
Posts: n/a
Default joining string

I'm new to php and have read the implode statement on php.net but I
guess I still don't understand it. Below is what I have:

$value = implode($disp_cap," - ",substr($value,0,300));

$disp_cap = Office Space
$value = 3,000 sq.ft. located at the intersection of...

I need the $value to join the two so I would get
Office Space - 3,000 sq.ft. located at the...

I get the error:
Warning: Wrong parameter count for implode() in
/home/GQ/public_html/bb/test.php on line 92

Thanks,
Chris


  #2  
Old July 17th, 2005, 01:30 PM
Dale
Guest
 
Posts: n/a
Default Re: joining string

$a = "Hello";
$b = "world";
$c = $a." ".$b;

echo $c;

"Hello World"

Is that what you want to do? Use the . "dot" to concat strings.

  #3  
Old July 17th, 2005, 01:30 PM
John T
Guest
 
Posts: n/a
Default Re: joining string

I think maybe you want to do this:

$value = $disp_cap." - ".substr($value,0,300);


<socialism001@yahoo.com> wrote in message
news:1118126102.364080.283710@o13g2000cwo.googlegr oups.com...[color=blue]
> I'm new to php and have read the implode statement on php.net but I
> guess I still don't understand it. Below is what I have:
>
> $value = implode($disp_cap," - ",substr($value,0,300));
>
> $disp_cap = Office Space
> $value = 3,000 sq.ft. located at the intersection of...
>
> I need the $value to join the two so I would get
> Office Space - 3,000 sq.ft. located at the...
>
> I get the error:
> Warning: Wrong parameter count for implode() in
> /home/GQ/public_html/bb/test.php on line 92
>
> Thanks,
> Chris
>[/color]


  #4  
Old July 17th, 2005, 01:30 PM
Alvaro G Vicario
Guest
 
Posts: n/a
Default Re: joining string

*** socialism001@yahoo.com wrote/escribió (6 Jun 2005 23:35:02 -0700):[color=blue]
> $value = implode($disp_cap," - ",substr($value,0,300));[/color]
[color=blue]
> Warning: Wrong parameter count for implode() in
> /home/GQ/public_html/bb/test.php on line 92[/color]

http://www.php.net/implode

As you can see, implode() does _not_ have three arguments.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
  #5  
Old July 17th, 2005, 01:30 PM
Tony
Guest
 
Posts: n/a
Default Re: joining string

<socialism001@yahoo.com> wrote in message
news:1118126102.364080.283710@o13g2000cwo.googlegr oups.com...[color=blue]
> I'm new to php and have read the implode statement on php.net but I
> guess I still don't understand it. Below is what I have:
>
> $value = implode($disp_cap," - ",substr($value,0,300));
>
> $disp_cap = Office Space
> $value = 3,000 sq.ft. located at the intersection of...
>
> I need the $value to join the two so I would get
> Office Space - 3,000 sq.ft. located at the...[/color]

I think simple concatenation would be better for what you want to achieve:

$finalString = $disp_cap . " - " . $value;



 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.