barfoon
barfoon

Reputation: 28157

Can anyone shed some light on why there is a big performance hit here?

1 or 2 seconds

$url = trim($_POST['url']);
$html = @file_get_contents($url);

30+ seconds to load

$url = $_POST['url'];
$html = @file_get_contents(trim($url));

I'm always curious when I discover things like this what is going on under the hood.

Cheers,

Upvotes: 1

Views: 78

Answers (1)

James
James

Reputation: 5169

I wouldn't be expecting that much of a performance increase for trim in fact, I've never seen anything that would even suggest why that would be happening.

What are you using to post your data with? Sure it's not a fluke?

Upvotes: 2

Related Questions