There's nothing wrong with that way, I was just proving Caleb wrong that's all.
Printable View
There's nothing wrong with that way, I was just proving Caleb wrong that's all.
oh right!!
Well, he sent me a pm (the OP) the other day asking for the code i posted which was an updated version of the one that was posted in the tutorials section.
We're not doing it 1000 times, or 100 times.. we're doing it one time. And when it comes down to it, my way (one time) if faster then your way.
http://projects.dopaul.com/test.php?...ce&hotel=co.uk
When it comes to doing it once, my way is faster.PHP Code:<?php
$hotel = $_GET["hotel"]; // abbrev.. co.uk, com, ca.
$data = @file_get_contents("http://www.habbo.{$hotel}");
if(!$data) {
exit("Could not grab data.");
}
require_once 'Benchmark/Timer.php';
//create an instance of the Benchmark_Timer class
$timer = new Benchmark_Timer();
//Set "Start" marker
$timer->start();
$pattern = '<span class="stats-fig">';
$pattern .= '(\\d+)';
$pattern .= '(<\\/span>)';
preg_match_all ("/{$pattern}/is", $data, $matches);
$timer->setMarker('caleb');
preg_match('#<span class="stats-fig">(\d+)</span>#i', $data, $matches);
$timer->setMarker('iszak');
//Set "Stop" marker
$timer->stop();
//Returns formatted informations
$timer->display(true);
?>
<br />
<br />
<strong>caleb benchmark code:</strong>
<br />
<code>
$pattern = '<span class="stats-fig">';<br />
$pattern .= '(\\d+)';<br />
$pattern .= '(<\\/span>)';<br />
<br />
preg_match_all ("/{$pattern}/is", $data, $matches);
</code>
<br />
<br />
<strong>iszak benchmark code:</strong><br />
<code>
preg_match('#<span class="stats-fig">(\d+)</span>#i', $data, $matches);
</code>
I'm confused as to how yours is faster?
http://www.tehupload.com/uploads/067...6b19bctemp.PNG
Refresh more then once.
I'll look at it later, I'm not feeling good/good enough mood to care at the moment.
I was showing yours was faster ^_^
Your testing has too many variables Caleb and thus has a less accurate result, check out mine (revised because you said "When it comes to doing it once, my way is faster.") still is faster :)
0.00012993812561 - Caleb
0.0000379085540771 - Mine
Edit: Same links by the way, for those who want to check it out.
Lol. I refresh and yours it faster.
Then I refresh again and his is faster.
And it just goes back and forth again and again. :rolleyes: