test - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of test.php
- <?php
- $a = array(0,1,2,3,4,5);
- $b = array('test'=>'test','test2'=>'test2','test3'=>'test3','test4'=>'test4');
- $v = 0;
- $n = 1000000;
- $startTime = microtime(true);
- for ($i = 0; $i <= $n; $i++)
- {
- $x = $v;
- }
- $endTime = microtime(true);
- $elapsed = $endTime - $startTime;
- echo "Variable : $elapsed seconds".PHP_EOL;
- $startTime = microtime(true);
- for ($i = 0; $i <= $n; $i++)
- {
- $x = $a[1];
- }
- $endTime = microtime(true);
- $elapsed = $endTime - $startTime;
- echo "Array: $elapsed seconds".PHP_EOL;
- $startTime = microtime(true);
- for ($i = 0; $i <= $n; $i++)
- {
- $x = $b['test3'];
- }
- $endTime = microtime(true);
- $elapsed = $endTime - $startTime;
- echo "Array by string key: $elapsed seconds";
File Description
- test
- PHP Code
- 19 Feb-2018
- 707 Bytes
You can Share it:
Latest PHP Pastes