<?php
$its = 1e5;
$true = true;
$fals = false;
$stri = 'string';
$t = hrtime(true);
for ( $i = 0; $i++ < $its; ) {
if ( $true );
if ( $fals );
if ( $stri );
}
echo 'plain : ', $old = ( hrtime(true)-$t ) / 1e9, "s\n";
$t = hrtime(true);
for ( $i = 0; $i++ < $its; ) {
if ( empty( $true ) );
if ( empty( $fals ) );
if ( empty( $stri ) );
}
echo 'empty : ', $old = ( hrtime(true)-$t ) / 1e9, "s\n";
$t = hrtime(true);
for ( $i = 0; $i++ < $its; ) {
if ( ! $true );
if ( ! $fals );
if ( ! $stri );
}
echo 'not : ', $old = ( hrtime(true)-$t ) / 1e9, "s\n";
$t = hrtime(true);
for ( $i = 0; $i++ < $its; ) {
if ( ! empty( $true ) );
if ( ! empty( $fals ) );
if ( ! empty( $stri ) );
}
echo 'notemp: ', $old = ( hrtime(true)-$t ) / 1e9, "s\n";
$t = hrtime(true);
for ( $i = 0; $i++ < $its; ) {
if ( isset( $true ) );
if ( isset( $fals ) );
if ( isset( $stri ) );
}
echo 'isset : ', $old = ( hrtime(true)-$t ) / 1e9, "s\n";
$t = hrtime(true);
for ( $i = 0; $i++ < $its; ) {
if ( ! isset( $true ) );
if ( ! isset( $fals ) );
if ( ! isset( $stri ) );
}
echo 'notiss: ', $old = ( hrtime(true)-$t ) / 1e9, "s\n";
preferences:
24.59 ms | 404 KiB | 5 Q