Advertisement
Gygaweb

php time to write strings array

Mar 10th, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.33 KB | Source Code | 0 0
  1. <?php
  2. $start = microtime(true);
  3.  
  4. // Escrever um array de string com 1000 elementos no console
  5. $arr = array_map(function($i) { return "linha " . ($i+1); }, range(0, 999));
  6. echo implode("\n", $arr);
  7.  
  8. $end = microtime(true);
  9. $timeInSeconds = number_format(($end - $start), 6);
  10.  
  11. echo "Tempo de execução: {$timeInSeconds} segundos";
  12.  
Tags: php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement