Skip to content

Tag: preg-match-all

Acessing values from preg_match_all in PHP 7.4

I am trying to access the values from the results of preg_match_all. Below is my coding: Below is the results of ensuring there are values: This my attempt to access the page location, i.e. 465,5400 etc.. I have tried various ways and (3 indices and 4 indices).I always end up with an error message – Arr…

Get multiple values from preg_match_all and use of foreach

I have tried to find a solution for my specific problem. I have a regex where I find two specific values. These values need to be combined in a foreach loop. String So I have this regex used with preg_match_all to fetch the alt text and the image itself: I can fetch the results individually by using print_r($…

Weird array structure in preg_match_all output PHP

I have pregmatch_all function that scrapes emails ! But the output is kind of weirdly structured and I don’t manage to restructure it. returns Two things please: How can I get rid of the “com” array ? How can I restructure the array in order to get : Array ( [0] => hello@soshape.com ) Any…