Jump to content

[SOLVED] Checking for a string and replacing


Tonic-_-

Recommended Posts

Hello, it's been awhile since i've gotten serious with php and i'm wondering how can I check for a specific string in the a number of lengths submitted by a form.

 

Example:

 

The user submits something like

12345678

 

I want to check the 3rd length 4th length and 5th length of the submitted text of each line.

 

What I mean by each line is like a form with a textarea so they can submit each line of something..

 

Example:

12345678 yada yada blah blah

nextline hereyada yada blah blah

blahblah yadayada blah blah

 

It's been quite some time since i've done php and can't seem to figure this out. I considered of use of detecting a certain string of text but I want to check only a certain length of it instead of a string variable.

 

Now which if the string matches to the variables I have set how can I make it replace it with a new text or modifying the string..

Well what I want to do (more clearly) is have users submit hex codes (values) through a textarea form and check a length of the string for EACH LINE to see if it equals to another string I have stored in a selected variable. I sorta figured out the checking part but always had troubles checking each line submitted by a textarea box.

 

Basically they submit stuff like

2040304 04040404

2040308 04040404

205030c 03030303

 

Check 204 and 205 for whatever my reason is and compare it to variables. I can do the actual check part just can't figure out how to read only the first 3 lengths of each line submitted by the text area.

 

If the first line matches the variable string i have set then display a checkmark or something beside the first line..

 

And basically continue the way I stated above for each line or whatever.

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.