Jump to content

Basic Question on arrays / strings!


niwa3836

Recommended Posts

Hi sorry silly question, bit stuck on

 

Basically I am writing some code to reformat a string that comes in with lots of spaces. I have to be a little clever in my program as some of the column headers dont quite match with the content below (sometimes out by 1 char).

 

The question is basically however: -

 

Lets say

$String = "This is a test" ;

and i then do

$out = "" ;

$out[0] = $String[0] ;

$out[1] = $String[1] ;

$out[2] = $String[2] ;

$out[3] = $String[3] ;

 

If I: -

print("Output " . $out) ;

 

it says Array, but I want it to print "This"

 

 

I know this is something silly but dont want to use print_r etc, is there a way of change $out array back to a normal string

 

Comments please!

Link to comment
https://forums.phpfreaks.com/topic/88404-basic-question-on-arrays-strings/
Share on other sites

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.