Skip to content

Instantly share code, notes, and snippets.

@raphaelm
Created April 18, 2010 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphaelm/370212 to your computer and use it in GitHub Desktop.
Save raphaelm/370212 to your computer and use it in GitHub Desktop.
PHP echo "",""; VS echo ""."";
<?php
ob_start();
$start = microtime(1);
for($i = 0; $i < 1000000; $i++){
echo "abc", "def", "ghi", "jkl", "mno", "pqr";
}
$end = microtime(1);
ob_end_clean();
echo "Kommas: ".(($end-$start)/1000000)."\n";
ob_start();
$start = microtime(1);
for($i = 0; $i < 1000000; $i++){
echo "abc"."def"."ghi"."jkl"."mno"."pqr";
}
$end = microtime(1);
ob_end_clean();
echo "Punkte: ".(($end-$start)/1000000);
@raphaelm
Copy link
Author

Typical output:
Kommas: 4.37817811966E-7
Punkte: 5.49797058105E-7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment