How fast is php_uname ()?

How fast php_uname () says it does php_uname( n')or php_uname('a'). The reason I ask is because I would like to use it to determine the server on which I am installed, and therefore the configuration (paths, etc.).

This is due to Is there a function or PHP variable giving a local host name?

+3
source share
2 answers

I just did this:

<?php
  $tstart = microtime(true);

  php_uname('a');

  print 'it took '. sprintf("%f",microtime(true) - $tstart) ." seconds\n";
?>

And this produced it:

it took 0.000016 seconds

That is, on the Debian 2.4GHz Core2Duo core.

I know this is an empirical test, and that’s it, but I think it shows that it will be fast enough for you.

I did not expect this to take a long time, since uname only needs to make a very simple kernel call.

+3
$_SERVER['HTTP_HOST']
0

Source: https://habr.com/ru/post/1698463/


All Articles