Didn't think two threads were needed, so I'll put both questions here.
1.
So, I want to do some good ol' fashioned php profiler. I just know I saw/read about a profiler/debugger somewhere so that I could install it at a module/extension layer (so I would have to touch my php code). I've seen this one called DBG made by Nusphere that people seem to swoon over, but I don't need any fancy shmancy interfacing with an IDE. I don't need to set tons of breakpoints, I would just like to get the profiler going, point it to an output file, and let the thing churn. If it's just a list of function calls and execution times, I'd go to sleep happy.
- Lets say I've got the following code:
$str = "The red dog";
$str2 = "This is an animal that is red and is a dog";
$arr = array();
preg_match("/The ([a-z]+) ([a-z]+)|This is an animal that is ([a-z]+) and is a ([a-z]+)/i",$str,$arr);
print_r($arr);
preg_match("/The ([a-z]+) ([a-z]+)|This is an animal that is ([a-z]+) and is a ([a-z]+)/i",$str2,$arr);
print_r($arr);
And the output:
Array
(
[0] => The red dog
[1] => red
[2] => dog
)
Array
(
[0] => This is an animal that is red and is a dog
[1] =>
[2] =>
[3] => red
[4] => dog
)
My curiosity is with the second array dump. I recognize that the values at index 1 and at 2 are the empty matches from the first half of the pattern in the preg_match, but I could honestly care less. I'm hoping I'm doing something wrong, because it seems kind of strange to be outputting 'matches' from one of the other selections in a
(SELECTIONA|SELECTIONπ subpattern. Ideally, I'd like to the results to look like this:
Array
(
[0] => The red dog
[1] => red
[2] => dog
)
Array
(
[0] => This is an animal that is red and is a dog
[1] => red
[2] => dog
)
Any ideas on either question? Thanks in advance!
Thanks in advance!