function lpsf_log($where, $str) { global $lpsf; if (is_null($where) || is_null($str) || $str == "") { die(Bnumber()); } insert_at_top($lpsf['errors'], $str, $lpsf['config']['errors_count']); return; }
function test_insert_at_top() { $test_arr = array('a', 'b', 'c', 'd'); $test_arr_result = array(99, 98, 97, 96, 95, 94, 93, 92, 91, 90); for ($i = 0; $i < 100; $i++) { insert_at_top($test_arr, $i, 10); } print_r($test_arr); print_r($test_arr_result); assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 1); // Create a handler function function my_assert_handler($file, $line, $code) { print "Assertion Failed: file({$file}) line({$line}) code(test_insert_at_top)" . PHP_EOL; } assert_options(ASSERT_CALLBACK, 'my_assert_handler'); assert($test_arr == $test_arr_result); }