Ejemplo n.º 1
0
<?php

print_r(wcx_array_rand(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), 2));
print_r(wcx_array_rand(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4)));
print_r(wcx_array_rand(array(1, 'b' => 2, 'c' => 3, 'd' => 4)));
print_r(wcx_array_rand(array(1, 'b' => 2, 'c' => array(1, 2, array(1, 2, 3)), 'd' => 4), 2));
Ejemplo n.º 2
0
$aes_key = 'todo';
$aes_text = 'If the assertion is given as a string it will be evaluated as PHP code by assert(). The advantages of a string assertion are less overhead when assertion checking is off and messages containing the assertion expression when an assertion fails. This means that if you pass a boolean condition as assertion this condition will not show up as parameter to the assertion function which you may have defined with the assert_options() function, the condition is converted to a string before calling that handler function, and the boolean FALSE is converted as the empty string.';
echo memory_get_usage() . "\n";
$t = microtime(1);
$times = 1;
while ($times <= 10000) {
    $result = wcx_encrypt($aes_text, $aes_key);
    wcx_decrypt($result, $aes_key);
    $times++;
}
echo microtime(1) - $t;
echo "\n";
echo memory_get_usage() . "\n";
var_dump(Service::decrypt($result, $aes_key));
var_dump(wcx_decrypt($result, $aes_key));
echo memory_get_usage() . "\n";
$t = microtime(1);
$times = 1;
while ($times <= 10000) {
    $result = Service::encrypt($aes_text, $aes_key);
    Service::decrypt($result, $aes_key);
    $times++;
}
echo microtime(1) - $t;
echo "\n";
echo memory_get_usage() . "\n";
// var_dump ( $result );
// // $result = Service::encrypt('hello', $aes_key);
// var_dump(Service::decrypt($result, $aes_key));
print_r(wcx_array_rand(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4), 2));