News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Recent posts

#11
PasteBin / Paste-1327944787:v:use_geshi-1...
Last post by SleePy - Jan 30, 2012, 05:33 PM
<?php
if (isset($_SERVER['_']))
   echo shell_exec($_SERVER['_'] .' -v | head -n 1');
else
   echo `php -v | head -n 1`;
echo "\n";

$array_size = 1000;
$array_data_size = 1000;
$loops = 1000;

$data = array();

for ($i = 0; $i < $array_size; $i++)
   $data[] = str_repeat('a', $array_data_size);

$data_serialized = serialize($data);
$data_json = json_encode($data);

echo 'Array Size: ' . $array_size . "\n";
echo 'Data Size: ' . $array_data_size . "\n";
echo 'Loops to run: ' . $array_data_size . "\n";

/******** SERIALIZE *************/
echo "\nSerialize: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   serialize($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON *************/
echo "\nJSON: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** SERIALIZE DECODE *************/
echo "\nSERIALIZE DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_serialized);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON DECODE *************/
echo "\nJSON DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_json);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';

echo "\n\n";
#12
PasteBin / Paste-1327944774:v:use_geshi-1...
Last post by SleePy - Jan 30, 2012, 05:32 PM
<?php
if (isset($_SERVER['_']))
   echo shell_exec($_SERVER['_'] .' -v | head -n 1');
else
   echo `php -v | head -n 1`;
echo "\n";

$array_size = 1000;
$array_data_size = 1000;
$loops = 1000;

$data = array();

for ($i = 0; $i < $array_size; $i++)
   $data[] = str_repeat('a', $array_data_size);

$data_serialized = serialize($data);
$data_json = json_encode($data);

echo 'Array Size: ' . $array_size . "\n";
echo 'Data Size: ' . $array_data_size . "\n";
echo 'Loops to run: ' . $array_data_size . "\n";

/******** SERIALIZE *************/
echo "\nSerialize: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   serialize($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON *************/
echo "\nJSON: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** SERIALIZE DECODE *************/
echo "\nSERIALIZE DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_serialized);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON DECODE *************/
echo "\nJSON DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_json);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';

echo "\n\n";
#13
PasteBin / Paste-1327944643:v:use_geshi-1...
Last post by SleePy - Jan 30, 2012, 05:30 PM
<?php
if (isset($_SERVER['_']))
   echo shell_exec($_SERVER['_'] .' -v | head -n 1');
else
   echo `php -v | head -n 1`;
echo "\n";

$array_size = 1000;
$array_data_size = 1000;
$loops = 1000;

$data = array();

for ($i = 0; $i < $array_size; $i++)
   $data[] = str_repeat('a', $array_data_size);

$data_serialized = serialize($data);
$data_json = json_encode($data);

echo 'Array Size: ' . $array_size . "\n";
echo 'Data Size: ' . $array_data_size . "\n";
echo 'Loops to run: ' . $array_data_size . "\n";

/******** SERIALIZE *************/
echo "\nSerialize: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   serialize($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON *************/
echo "\nJSON: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** SERIALIZE DECODE *************/
echo "\nSERIALIZE DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_serialized);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';


/******** JSON DECODE *************/
echo "\nJSON DECODE: ";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_json);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . ' (Start: ' . $stop . ' | Stop: ' . $start . ')';

echo "\n\n";
#14
PasteBin / Paste-1327944527:v:use_geshi-1...
Last post by SleePy - Jan 30, 2012, 05:28 PM
<?php
if (isset($_SERVER[\'_\']))
   echo shell_exec($_SERVER[\'_\'] .\' -v | head -n 1\');
else
   echo `php -v | head -n 1`;
echo \"\\n\";

$array_size = 1000;
$array_data_size = 1000;
$loops = 1000;

$data = array();

for ($i = 0; $i < $array_size; $i++)
   $data[] = str_repeat(\'a\', $array_data_size);

$data_serialized = serialize($data);
$data_json = json_encode($data);

echo \'Array Size: \' . $array_size . \"\\n\";
echo \'Data Size: \' . $array_data_size . \"\\n\";
echo \'Loops to run: \' . $array_data_size . \"\\n\";

/******** SERIALIZE *************/
echo \"\\nSerialize: \";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   serialize($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . \' (Start: \' . $stop . \' | Stop: \' . $start . \')\';


/******** JSON *************/
echo \"\\nJSON: \";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . \' (Start: \' . $stop . \' | Stop: \' . $start . \')\';


/******** SERIALIZE DECODE *************/
echo \"\\nSERIALIZE DECODE: \";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_serialized);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . \' (Start: \' . $stop . \' | Stop: \' . $start . \')\';


/******** JSON DECODE *************/
echo \"\\nJSON DECODE: \";
$start = microtime(true);

for ($i = 0; $i < $loops; $i++)
   json_encode($data_json);

$stop = microtime(true);
$diff = $stop - $start;

echo round($diff, 3) . \' (Start: \' . $stop . \' | Stop: \' . $start . \')\';

echo \"\\n\\n\";
#15
PasteBin / Paste-1327380247:v:use_geshi-1...
Last post by SleePy - Jan 24, 2012, 04:44 AM
Lovely testing we are doing
Update test
#16
PasteBin / Paste-1327380212:v:use_geshi-1...
Last post by SleePy - Jan 24, 2012, 04:43 AM
Lovely testing we are doing
#17
PasteBin / Paste-1327375853:v:use_geshi-1...
Last post by SleePy - Jan 24, 2012, 03:30 AM
test2
new
more
Another
More
Third
again
Finally
#18
PasteBin / Paste-1327375845:v:use_geshi-1...
Last post by SleePy - Jan 24, 2012, 03:30 AM
test2
new
more
Another
More
Third
again
#19
PasteBin / Paste-1327375733:v:use_geshi-1...
Last post by SleePy - Jan 24, 2012, 03:28 AM
test2
new
more
Another
More
Third
#20
PasteBin / Paste-1327107724:v:use_geshi-1...
Last post by SleePy - Jan 21, 2012, 01:02 AM
/*
* userInfo as a class.  We kinda do a poor method, but its the best way for now.
*/
class userInfo
{
   public static $instanceID = 0;

   public static function _()
   {
      if (self::$instanceID == 0)
         self::$instanceID = new userInfo;

      return self::$instanceID;
   }

   public function __set($key, $value)
   {
      global $user_info;
      $user_info[$key] = $value;
   }

   public function __get($key)
   {
      global $user_info;
      return isset($user_info[$key]) ? $user_info[$key] : null;
   }

   public function __isset($key)
   {
      global $user_info;
      return isset($user_info[$key]);
   }

   public function __unset($key)
   {
      global $user_info;
      unset($user_info[$key], $user_info[$key]);
   }
}