本文整理汇总了PHP中test函数的典型用法代码示例。如果您正苦于以下问题:PHP test函数的具体用法?PHP test怎么用?PHP test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了test函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appControllerLoad
public function appControllerLoad()
{
$TestModel = new TestModel();
$list = $TestModel->getList();
json_return($list);
test();
}
示例2: do_action
function do_action($glob)
{
for ($i = 0; $glob['list_action'][$i]; $i++) {
if ($glob['list_action'][$i]['done'] == 0) {
$action_name = $glob['list_action'][$i]['nom_action'];
if (substr($action_name, 0, 2) == "b_") {
$glob['list_action'][$i]['done'] = 1;
$glob['list_action'][$i]['waiting_answer'] = 1;
$glob = call_user_func($action_name, $glob);
$glob['big'] = 1;
$glob = update_actions($glob);
return $glob;
} else {
$glob['list_action'][$i]['done'] = 1;
$glob['list_action'][$i]['waiting_answer'] = 0;
$glob = call_user_func($action_name, $glob);
$glob['big'] = 0;
$glob = update_actions($glob);
return $glob;
}
}
}
print_r($glob);
test("action end " . $glob['total_action']);
// Devrait jamais arrive la
aff_error_code("end done");
return $glob;
}
示例3: content_567fc7c430caf3_85180294
function content_567fc7c430caf3_85180294($_smarty_tpl)
{
echo test(array('p1' => 'ab', 'p2' => 'asd', 'p3' => 'ddd', 'p4' => 'qwe'), $_smarty_tpl);
?>
<?php
}
开发者ID:nnqx,项目名称:Jianbing_PHP,代码行数:7,代码来源:426b7a1a9d2f99a8c921fec51c2400f886cfd85e_0.file.test.tpl.php
示例4: allTests
function allTests($communicator)
{
global $NS;
echo "testing type names... ";
flush();
$a = $NS ? constant("_and\\_array::_as") : constant("and_array::_as");
$b = $NS ? eval("return new _and\\_xor();") : eval("return new and_xor();");
test($b->_abstract == 0);
test($b->_clone == 0);
test($b->_private == 0);
test($b->_protected == 0);
test($b->_public == 0);
test($b->_this == 0);
test($b->_throw == 0);
test($b->_use == 0);
test($b->_var == 0);
$p = $communicator->stringToProxy("test:tcp -p 10000");
$c = $NS ? eval("return _and\\functionPrxHelper::uncheckedCast(\$p);") :
eval("return and_functionPrxHelper::uncheckedCast(\$p);");
$d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") :
eval("return and_diePrxHelper::uncheckedCast(\$p);");
$e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") :
eval("return and_echoPrxHelper::uncheckedCast(\$p);");
$e1 = new echoI();
$f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") :
eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);");
$f1 = new enddeclareI();
$g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();");
$h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();");
$i = $NS ? constant("_and\\_or") : constant("and_or");
$j = $NS ? constant("_and\\_print") : constant("and_print");
$j = $NS ? constant("_and\\_require_once") : constant("and_require_once");
echo "ok\n";
}
示例5: just_do_it
function just_do_it($flag)
{
test();
if ($flag < 10) {
usleep(2 * 1000 * 1000);
}
}
示例6: main
function main($x)
{
for ($i = 0; $i < 10; $i++) {
test($x, $x);
}
return test($x, $x);
}
示例7: start
function start()
{
$neuralNetwork = new NeuralNetworkHopfield(9);
$trainingDatas = prepareTrainingDatas();
$neuralNetwork->learn($trainingDatas);
test($neuralNetwork);
}
示例8: learn
function learn(NeuralNetwork $neuralNetwork, array $trainingDatas)
{
/* @var $trainingDatas TrainingData[] */
test($neuralNetwork);
$historicErrors = [];
$i = 0;
while (true) {
$errors = [];
/*?>
<table style=""><tr>
<th>dane</th>
<th>wynik</th>
<th>spodziewany</th>
<th>błąd</th>
</tr><?php*/
foreach ($trainingDatas as $trainingData) {
/*?><tr><?php*/
$result = $neuralNetwork->calculate($trainingData->getData());
$error = $neuralNetwork->getError($result, $trainingData->getExpectedResult());
$errors[] = $error;
/*?><td><?php foreach($trainingData->getData() as $v) { echo round($v, 2).' '; } ?></td><?php
?><td><?= round($result[0], 2) ?></td><?php
?><td><?= round($trainingData->getExpectedResult()[0], 2) ?></td><?php
?><td><?= round($error, 2) ?></td><?php
?><td><?php*/
$neuralNetwork->correctWeights($result, $trainingData->getExpectedResult());
/*?></td><?php
?></tr><?php*/
}
// if ($i % 5000 == 0) {
// test($neuralNetwork);
// }
/*?></table><?php*/
// test($neuralNetwork);
// echo '<div style="width: '.(avg($errors) * 1000).'px; height: 1px; background: #666;"></div>';
// echo '<b>'.round(avg($errors), 3).'</b><br>';
if (avg($errors) < 0.01) {
return;
}
$i++;
if ($i > 1) {
$lastHistoricErrors = array_slice($historicErrors, -50);
if (avg($lastHistoricErrors) > avg($historicErrors)) {
$historicErrors = [];
$i = 0;
test($neuralNetwork);
$neuralNetwork->rerandomizeWeights();
//test($neuralNetwork);
}
}
$historicErrors[] = avg($errors);
if ($i == 100000) {
echo 'break';
break;
}
shuffle($trainingDatas);
}
}
示例9: content_55f55f40447242_10092157
function content_55f55f40447242_10092157($_smarty_tpl)
{
$_smarty_tpl->properties['nocache_hash'] = '2180455f55f4037d769_80171613';
?>
title: <?php
echo $_smarty_tpl->tpl_vars['title']->value;
?>
<br>
content: <?php
echo $_smarty_tpl->tpl_vars['content']->value;
?>
<br>
<?php
echo myfun();
?>
<br>
<?php
echo date("Y-m-d");
?>
<br>
<?php
echo test(array('size' => "10", 'color' => "red", 'num' => "5", 'content' => "222"), $_smarty_tpl);
?>
<br>
<?php
}
开发者ID:suchfun,项目名称:smarty,代码行数:32,代码来源:cd2e5aa04ccacd3b7a8b3321861fb48284789391_0.file.demo2.html.cache.php
示例10: update_default_page
/**
* Update content of a default page.
*
* If $tag parameter is an array, it just passes elements of this array one by one to itself.
* The value 'HomePage' is a special one: it will be replaced by the configured value $config['root_page'].
* The content of the page is read at a file named with $tag, located in setup/default_pages.
* @param mixed $tag string or array of strings
* @param resource $dblink
* @param mixed $config
* @param string $lang_defaults_path mandatory: validated directory for language-specific default pages
* @param string $lang_defaults_fallback_path mandatory: validated directory for default pages in system default language
* @access public
* @return void
* @todo avoid recursion: make a single tag into an array of one and then just loop over the tags
*/
function update_default_page($tag, $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path, $note = '')
{
if (is_array($tag)) {
foreach ($tag as $v) {
update_default_page($v, $dblink, $config, $lang_defaults_path, $lang_defaults_fallback_path, $note);
}
return;
}
$filename = $tag;
if ($tag == '_rootpage') {
$tag = $config['root_page'];
$filename = 'HomePage';
}
$admin_users = explode(',', $config['admin_users']);
$admin_main_user = trim($admin_users[0]);
//$txt_filepath = $lang_defaults_path.$filename.'.txt';
$php_filepath = $lang_defaults_path . $filename . '.php';
if (!file_exists($php_filepath) || !is_readable($php_filepath)) {
$php_filepath = $lang_defaults_fallback_path . $filename . '.php';
}
if (file_exists($php_filepath) && is_readable($php_filepath)) {
ob_start();
include_once $php_filepath;
$body = ob_get_contents();
ob_end_clean();
//$body = implode('', file($txt_filepath));
mysql_query('update ' . $config['table_prefix'] . 'pages set latest = "N" where tag = \'' . $tag . '\'', $dblink);
test(sprintf(__('Adding/Updating default page %s' . '...'), $tag), @mysql_query('insert into ' . $config['table_prefix'] . 'pages set tag=\'' . $tag . '\', body = \'' . mysql_real_escape_string($body) . '\', user=\'WikkaInstaller\', owner = \'' . $admin_main_user . '\', time=now(), latest =\'Y\', note = \'' . mysql_real_escape_string($note) . '\'', $dblink), '', 0);
// @@@ pick up any page-specific ACL here (look in both $lang_defaults_path and $lang_defaults_fallback_path)
} else {
test(sprintf(__('Adding/Updating default page %s' . '...'), $tag), false, sprintf(__('Default page not found or file not readable (%s, %s, %s)'), $tag, $php_filepath, $lang_defaults_path), 0);
}
}
示例11: main
function main($a)
{
try {
test(...$a);
} catch (Exception $e) {
}
}
示例12: allTests
function allTests()
{
global $NS;
echo "testing Slice predefined macros... ";
flush();
if ($NS) {
$d = new Test\_Default();
test($d->x == 10);
test($d->y == 10);
$nd = new Test\NoDefault();
test($nd->x != 10);
test($nd->y != 10);
$c = new Test\PhpOnly();
test($c->lang == "php");
test($c->version == Ice\intVersion());
} else {
$d = new Test_Default();
test($d->x == 10);
test($d->y == 10);
$nd = new Test_NoDefault();
test($nd->x != 10);
test($nd->y != 10);
$c = new Test_PhpOnly();
test($c->lang == "php");
test($c->version == Ice_intVersion());
}
echo "ok\n";
}
示例13: pageEntry
public function pageEntry($inPath)
{
/*
*/
SError::$CONSOLE = true;
/*
*/
SError::$LOG = false;
/*
*/
SError::$LOGFILE = "/tmp/tmp_serror.log";
echo $DDJFK;
function test($B)
{
test2($B);
}
function test2($a)
{
echo "{$B}.{$a}";
//throw new Exception("D2D");
//throw new Exception("DD");
}
echo "D";
test("FJKE", "E");
throw new Exception("DD");
echo "D";
//test("B","c");
}
示例14: move_to_yaml
function move_to_yaml()
{
$sql = SQL::current();
if (!($attrs = $sql->select("post_attributes", "*", array("name" => array("unclean_tags", "clean_tags"))))) {
return;
}
function parseTags($tags, $clean)
{
$tags = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $tags));
$clean = explode(",", preg_replace("/\\{\\{([^\\}]+)\\}\\}/", "\\1", $clean));
return array_combine($tags, $clean);
}
$tags = array();
foreach ($attrs->fetchAll() as $attr) {
if ($attr["name"] == "unclean_tags") {
$tags[$attr["post_id"]]["unclean"] = $attr["value"];
} else {
$tags[$attr["post_id"]]["clean"] = $attr["value"];
}
}
if (empty($tags)) {
return;
}
foreach ($tags as $post_id => $tags) {
$yaml = YAML::dump(parseTags($tags["unclean"], $tags["clean"]));
echo _f("Relocating tags for post #%d...", array($post_id), "tags");
echo test($insert = $sql->replace("post_attributes", array("name" => "tags", "value" => $yaml, "post_id" => $post_id)), _f("Backup written to %s.", array("./_tags.bak.txt")));
if (!$insert) {
return file_put_contents("./_tags.bak.txt", var_export($tags, true));
}
}
echo __("Removing old post attributes...", "tags") . test($sql->delete("post_attributes", array("name" => array("unclean_tags", "clean_tags"))));
}
示例15: test_get_arg
function test_get_arg(string $type, array $extra_args)
{
$cnt = count($extra_args) + func_num_args() - 1;
for ($i = -1; $i <= $cnt; ++$i) {
test('gen_func_get_arg_' . $type, array_merge(array_slice(func_get_args(), 2), array($i), $extra_args));
}
}