Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [603] Wed 17.Oct.2012 12:51:42
- [kadmin@freebsd-devel][~] cat yoda
- <?php
- function a() {
- $x=1;
- while ($x<100000000) {
- if (FALSE === $x) {
- $out = "X is false \n";
- } else {
- $out = "X is true \n";
- }
- $x++;
- }
- }
- function b() {
- $x=1;
- while ($x<100000000) {
- if ($x === FALSE) {
- $out = "X is false \n";
- } else {
- $out = "X is true \n";
- }
- $x++;
- }
- }
- $start=microtime(1);
- a();
- $end=microtime(1);
- echo "Function a took ".($end-$start). " seconds.\n";
- $start=microtime(1);
- b();
- $end=microtime(1);
- echo "Function b took ".($end-$start). " seconds.\n";
- [604] Wed 17.Oct.2012 12:51:44
- [kadmin@freebsd-devel][~] php yoda
- Function a took 15.374212026596 seconds.
- Function b took 16.012656927109 seconds.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement