Jump to content

Need some help !


xeqtor

Recommended Posts

Hi, i have a small problem. I have the following code

 

preg_match_all( '/<input.*?type="hidden".*?name="(.*?)"/i',$city, $matchess);
print_r($matchess);

 

with the following output

 

Array
(
    [0] => Array
        (
            [0] =>         Array
        (
            [0] => postingKey
            [1] => test
            [2] => FromEMail
            [3] => U2FsdGVkX18xOTQ4NTE5NAvvHFIJkuiw06vyBJgJnjYgoV0kwwYoj3Q_u-yB:BLKda6tSlT3qsUg
            [4] => image1
            [5] => image2
            [6] => image3
            [7] => image4
        )

)

 

 

How can I get the array items to individual strings? I tried $matchess[0][1] and some more.

 

Thank you in advance.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/189201-need-some-help/
Share on other sites

Given the preg_match_all call that you are making the correct way to access the results would be $matches[1][x] where x indicates the position in the results of the match you want. So $matches[1][0] would be the name attribute of the first input tag, $matches[1][1] would be the second etcetera. Not quite sure how the output you posted fits.

Link to comment
https://forums.phpfreaks.com/topic/189201-need-some-help/#findComment-999267
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.