Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.