Php Array!

Zeus2005

New Member
Hey!

Can anyone who knows php (or even just programming) help me?

I am trying to access an array (thats been loaded form a text file) and change/edit the 6th character of it,

so if my array at index 1 is "my name is kris"
, how would I be able to acess/change the 6th character ("m") before I print it?

Thanks!
 
you can use the function: substr( {string}, {where to start (from left to right)}, {length returned})
 
thats a lot!, thats done the trick!

now that I have removed the first 5 characters, how would I go about keepinng characters 6 to 10, removing characters 11 to 15 and then displaying characters 16 to 25, if you know what I mean. I would give it more attempts myself but my web server is ftp so takes ages to copy the new .php file over every time after making a tiny change, to get an error :( .

Thanks!
 
Zeus2005 said:
thats a lot!, thats done the trick!

now that I have removed the first 5 characters, how would I go about keepinng characters 6 to 10, removing characters 11 to 15 and then displaying characters 16 to 25, if you know what I mean. I would give it more attempts myself but my web server is ftp so takes ages to copy the new .php file over every time after making a tiny change, to get an error :( .

Thanks!
wow i feel like u guys are talking a different language...:P
 
Zeus2005 said:
thats a lot!, thats done the trick!

now that I have removed the first 5 characters, how would I go about keepinng characters 6 to 10, removing characters 11 to 15 and then displaying characters 16 to 25, if you know what I mean. I would give it more attempts myself but my web server is ftp so takes ages to copy the new .php file over every time after making a tiny change, to get an error :( .

Thanks!

From what I remember, the first character is 0 so 5 represents the 6th character in the array and 15 is the 16th character:

substr({string},5,5).substr({string},15,10)
 
right, after hours of programming iv finnally managed to get the display from the text file onto my webpage, having removed all of the specific characters that i wanted removed. However, the php now displays all the lines ok but they are not lined up or formatted nicely, and due to the way I had to code the php, I cant format it within the php.
(its like a table, names, and numbers eg.
kris 50 30 52
dan 232 23 20
etc

but since each field can be a different length, I cant split each flied into a variable, if you know what I mean.

Anyway, thats just the upday, my question is, Can I now format the html output I have on the page somehow?, since I cant (iv tried for hours) format it in php. I would like it to be in a table form so that name/number length wont effect the display because there is plenty of space around it and its all aligned and things.


Thanks!
 
Back
Top