• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP test1函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中test1函数的典型用法代码示例。如果您正苦于以下问题:PHP test1函数的具体用法?PHP test1怎么用?PHP test1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了test1函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: test1

function test1($i)
{
    echo $i, '<br/>';
    //1
    ++$i;
    if ($i <= 4) {
        test1($i);
        //test1(2)
        /*
        echo $i,'<br/>';//2
        		++$i;
        		if($i<=10){
        			test1($i);//test1(3)
        				echo $i,'<br/>';//3
        				++$i;
        				if($i<=4){
        					test1($i);//test1(4)
        						echo $i,'<br/>';//4
        						++$i;
        						if($i<=4){
        							test1($i);
        						}
        				}
        		}
        */
    }
}
开发者ID:denson7,项目名称:phpstudy,代码行数:27,代码来源:func6.php


示例2: run

 public function run()
 {
     $r = 0;
     for ($i = 0; $i < self::DEFAULT_ITERATIONS; $i++) {
         $r += test1() + test2(1, 2, 3) + self::test1() + self::test2(1, 2, 3);
     }
 }
开发者ID:bklein01,项目名称:jphp,代码行数:7,代码来源:ConstantCallBenchmark.php


示例3: content_5236ae0304b8c2_40162505

    function content_5236ae0304b8c2_40162505($_smarty_tpl)
    {
        ?>
<h1>自定义函数yu 以block 方式显示</h1>
<?php 
        $_smarty_tpl->smarty->_tag_stack[] = array('yu2', array('times' => "5", 'size' => "5", 'color' => "blue"));
        $_block_repeat = true;
        echo test2(array('times' => "5", 'size' => "5", 'color' => "blue"), null, $_smarty_tpl, $_block_repeat);
        while ($_block_repeat) {
            ob_start();
            ?>
hello world<?php 
            $_block_content = ob_get_clean();
            $_block_repeat = false;
            echo test2(array('times' => "5", 'size' => "5", 'color' => "blue"), $_block_content, $_smarty_tpl, $_block_repeat);
        }
        array_pop($_smarty_tpl->smarty->_tag_stack);
        ?>

<h1>自定义函数yu 以function 方式显示</h1>
<?php 
        echo test1(array('times' => "5", 'size' => "5", 'content' => "hello 栩坚", 'color' => "red"), $_smarty_tpl);
        ?>


<?php 
    }
开发者ID:yuxujian,项目名称:YuNote,代码行数:27,代码来源:729987baba90315a0fe9ccb37578627448444efc.file.example7.tpl.php


示例4: test

function test($test)
{
    test1();
    TeSt1();
    $test();
    $test = strtolower($test);
    $test(1, 2, 3);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:1195.php


示例5: test1

function test1($path = '', $lv = 0)
{
    file_exists($path) or die($path . ' is not find');
    $head = opendir($path) or die('open the dir is error');
    while (false !== ($file = readdir($head))) {
        $sub_dir = $path . '\\' . $file;
        if ($file == '.' || $file == '..') {
            continue;
        } else {
            if (is_dir($sub_dir)) {
                echo str_repeat('-', $lv) . $file . "\n";
                test1($sub_dir, $lv + 1);
            } else {
                echo str_repeat('-', $lv) . $file . "\n";
            }
        }
    }
}
开发者ID:zhangpanfei,项目名称:test,代码行数:18,代码来源:file_path.php


示例6: unset

//5
echo '<hr/>';
$j = 10;
echo $i, '<br/>';
//10
unset($i);
//
var_dump($i);
//NULL
echo $j, '<br/>';
function test1(&$i)
{
    $i = 15;
}
$i = 2;
test1($i);
var_dump($i);
//15
echo '<hr/>';
/*
Fatal error: Only variables can be passed by reference in
F:\psd1507\study\PHPCORE\day08\demo\func4.php on line 50
*/
// test1(3);
$filename = '1.txt.jpeg';
/*
Strict Standards: Only variables should be passed by reference in F:\psd1507\study\PHPCORE\day08\demo\func4.php on line 58
jpeg
*/
$arr = explode('.', $filename);
echo end($arr);
开发者ID:denson7,项目名称:phpstudy,代码行数:31,代码来源:func4.php


示例7: test1

[file]
<?php 
// test1
echo "test1 (PassedByCopy):\n";
function test1($x)
{
    $x[] = 4;
    var_dump($x);
    return $x;
}
$x = array();
$x[0] = 1;
$x[1] = 2;
$x[2] = 3;
unset($x[2]);
$x = test1($x);
$x[] = 5;
var_dump($x);
// test2
echo "\n\ntest2 (ReturnedByCopy):\n";
function test2()
{
    $x = array(1, 2, 3);
    unset($x[2]);
    var_dump($x);
    return $x;
}
$x = test2($x);
$x[] = 4;
var_dump($x);
// test3
开发者ID:dw4dev,项目名称:Phalanger,代码行数:31,代码来源:array_unset_add.php


示例8: array

$favorites = array('favcolor' => 'red', 'favmovie' => 'shawshank', 'favsong' => 'Yellow submarine');
function test1($favorites)
{
    $buf = '';
    foreach ($favorites as $fav) {
        $buf .= $fav;
    }
    echo 'Test foreach($arr as $val)' . "<br>\n";
    echo 'result: ' . ($buf === 'redshawshankYellow submarine' ? 'pass' : 'fail') . "<br><br>\n\n";
}
function test2($favorites)
{
    $buf = '';
    foreach ($favorites as $key => $val) {
        $buf .= "{$key}: {$val},";
    }
    echo 'Test foreach($arr as $key => $val)' . "<br>\n";
    echo 'result: ' . ($buf === 'favcolor: red,favmovie: shawshank,favsong: Yellow submarine,' ? 'pass' : 'fail') . "<br><br>\n\n";
}
function test3()
{
    $arr = array(1, 2, 3);
    foreach ($arr as $i) {
        $i += 1;
    }
    echo 'Test foreach($arr as $val) { $val += 1 }' . "<br>\n";
    echo 'result: ' . ($i == 4 ? 'pass' : 'fail') . "<br><br>\n\n";
}
test1($favorites);
test2($favorites);
test3();
开发者ID:rex786,项目名称:php2js,代码行数:31,代码来源:foreach.php


示例9: test1

<?php

function test1(&$abc) : string
{
    return $abc;
}
function &test2(int $abc) : string
{
    return $abc;
}
function &test3(int &$abc) : string
{
    return $abc;
}
$a = 123;
var_dump(test1($a));
var_dump($a);
var_dump(test2($a));
var_dump($a);
var_dump(test3($a));
var_dump($a);
开发者ID:gleamingthecube,项目名称:php,代码行数:21,代码来源:Zend_tests_return_types_return_reference_separation.php


示例10: Benchmark

<?php

use Lavoiesl\PhpBenchmark\Benchmark;
use Ovr\Bench\AssignOrNot\ReturnAfterAssignProperty;
use Ovr\Bench\AssignOrNot\ReturnWithoutAfterAssignProperty;
include_once __DIR__ . '/vendor/autoload.php';
$benchmark = new Benchmark();
function proxy($a, $b, $c)
{
    return true;
}
function test1()
{
    return proxy(...func_get_args());
}
function test2(...$args)
{
    return proxy(...$args);
}
$benchmark->add('...func_get_args()', function () use(&$str) {
    return test1(1, 2, 3);
});
$benchmark->add('....$args', function () use(&$str) {
    return test2(1, 2, 3);
});
$benchmark->setCount(10000000);
$benchmark->run();
开发者ID:ovr,项目名称:php-web-benchmarks,代码行数:27,代码来源:func_get_args_and_3_dots.php


示例11: test2

function test2($a, $b)
{
    test1($b, $a);
}
开发者ID:SandyS1,项目名称:presentations,代码行数:4,代码来源:file2.php


示例12: smarty_core_load_plugins

<?php

/* Smarty version 2.6.27, created on 2013-09-16 20:17:57
   compiled from example7.tpl */
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins(array('plugins' => array(array('function', 'yu', 'example7.tpl', 3, false), array('block', 'yu2', 'example7.tpl', 6, false))), $this);
?>

<h1>自定义函数yu 以function 方式显示</h1>
<?php 
echo test1(array('times' => '5', 'size' => '5', 'content' => "hello 栩坚", 'color' => 'red'), $this);
?>


<h1>自定义函数yu 以block 方式显示</h1>
<?php 
$this->_tag_stack[] = array('yu2', array('times' => '5', 'size' => '5', 'color' => 'blue'));
$_block_repeat = true;
test2($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat);
while ($_block_repeat) {
    ob_start();
    ?>
hello world<?php 
    $_block_content = ob_get_contents();
    ob_end_clean();
    $_block_repeat = false;
    echo test2($this->_tag_stack[count($this->_tag_stack) - 1][1], $_block_content, $this, $_block_repeat);
}
array_pop($this->_tag_stack);
开发者ID:yuxujian,项目名称:YuNote,代码行数:29,代码来源:%%CF^CF9^CF9C6606%%example7.tpl.php


示例13: sumArray

<?php

function sumArray($intArray)
{
    $total = 0;
    foreach ($intArray as $value) {
        $total += $value;
    }
    return $total;
}
function test1(Form $form)
{
    return 1;
}
function test2(array $array)
{
    return sumArray($array);
}
$test1 = test1(null);
assert($test1, 1);
$testArray = array(1, 2, 3);
$test2 = test2($testArray);
assert($test2, 6);
testEnd();
开发者ID:microcosmx,项目名称:experiments,代码行数:24,代码来源:TypeHinting.php


示例14: main

function main()
{
    var_dump(test1());
}
开发者ID:badlamer,项目名称:hhvm,代码行数:4,代码来源:shuffle3.php


示例15: test1

<?php

function test1()
{
    $a = array(__FUNCTION__, __LINE__);
    return $a;
}
function test2()
{
    $a = array(__FUNCTION__, __LINE__);
    return $a;
}
var_dump(test1());
var_dump(test2());
开发者ID:badlamer,项目名称:hhvm,代码行数:14,代码来源:546.php


示例16: test1

}
test1(...[1, 2, 3]);
$array = [1, 2, 3];
test1(...$array);
var_dump($array);
$array1 = [1, 2];
$array2 = [3, 4];
test1(...$array1, ...$array2);
var_dump($array1, $array2);
function test2($val1, &$ref1, $val2, &$ref2)
{
    $ref1++;
    $ref2++;
}
$array = [0, 0, 0, 0];
test2(...$array);
var_dump($array);
$array1 = [1, 2];
$array2 = [4, 5];
test1(...$array1, ...$array2);
var_dump($array1, $array2);
$a = $b = $c = $d = 0;
$array = [0, 0, 0, 0];
test2($a, ...$array);
var_dump($a, $array);
test2($a, $b, ...$array);
var_dump($a, $b, $array);
test2($a, $b, $c, ...$array);
var_dump($a, $b, $c, $array);
test2($a, $b, $c, $d, ...$array);
var_dump($a, $b, $c, $d, $array);
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:by_ref.php


示例17: bar2

 /**
  * @ProfileGroup("Foo Group")
  * @ProfileCaption("Caption of bar2 #1 #2.")
  */
 function bar2($lambda, $object)
 {
     return test1();
 }
开发者ID:nextop,项目名称:forp-ui,代码行数:8,代码来源:common.php


示例18: test1

<?php

function test1() : Generator
{
    (yield 1);
}
function test2() : Iterator
{
    (yield 2);
}
function test3() : Traversable
{
    (yield 3);
}
var_dump(test1(), test2(), test3());
开发者ID:gleamingthecube,项目名称:php,代码行数:15,代码来源:Zend_tests_return_types_generators001.php


示例19: test

<?php

function test()
{
    $GLOBALS['a']['b'] = 1;
    $GLOBALS['c'] = 1;
}
function test1(array $arr)
{
}
function test2(int $arr)
{
}
test();
test1($c);
test2($a);
开发者ID:hslatman,项目名称:phan,代码行数:16,代码来源:0024_GLOBALS.php


示例20: test1

<?php

function test1(...$args)
{
    var_dump($args);
}
test1();
test1(1);
test1(1, 2, 3);
function test2($arg1, $arg2, ...$args)
{
    var_dump($arg1, $arg2, $args);
}
test2(1, 2);
test2(1, 2, 3);
test2(1, 2, 3, 4, 5);
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:basic.php



注:本文中的test1函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP test2函数代码示例发布时间:2022-05-23
下一篇:
PHP test函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap