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

PHP func函数代码示例

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

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



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

示例1: command_parse

 function command_parse()
 {
     global $DB, $Core, $Parse, $Security, $Base, $Style;
     if (!$Security->allowed()) {
         return;
     }
     $include = implode("/", module());
     if (file_exists("module/{$include}/main.php")) {
         $dir = "";
         foreach (module() as $module) {
             $dir .= "{$module}/";
             $shared = "module/{$dir}shared.php";
             if (file_exists($shared)) {
                 include $shared;
             }
         }
         require_once "module/{$include}/main.php";
         if (function_exists(command())) {
             eval(command() . "();");
         }
         if (file_exists("module/{$include}/.content/" . func() . ".php")) {
             if (!get('ajax') && !get('xml')) {
                 require_once "module/{$include}/.content/" . func() . ".php";
             }
         }
     } else {
         $Base = new Base();
         $Base->title("Invalid Module");
         $Base->Header();
         $Base->Footer();
     }
 }
开发者ID:jmichaelward,项目名称:pgBoard,代码行数:32,代码来源:Core.php


示例2: funcfunc

function funcfunc()
{
    try {
        func();
    } catch (Exception $ex) {
        throw $ex;
    }
}
开发者ID:jenalgit,项目名称:roadsend-php,代码行数:8,代码来源:exceptions.php


示例3: debug

function debug()
{
    print "<strong>query string:</strong> {$_SERVER['QUERY_STRING']}\n\n";
    print "<strong>module:</strong> " . implode("-", module()) . "\n";
    print "<strong>function:</strong> " . func() . "\n";
    print "<strong>method:</strong> " . method() . "\n\n";
    print "<strong>include:</strong> /module/" . implode("/", module()) . "/main.php\n\n";
    print "<strong>run:</strong> " . command() . "\n\n";
}
开发者ID:jmichaelward,项目名称:pgBoard,代码行数:9,代码来源:error.php


示例4: test2

function test2()
{
    function func($fname = array('ball'))
    {
        return $fname;
    }
    $result1 = func();
    echo "Test that empty array default parameter works as expected.<br>\n";
    echo 'result: ' . ($result1[0] == 'ball' ? 'pass' : 'fail') . "<br><br>\n\n";
}
开发者ID:rex786,项目名称:php2js,代码行数:10,代码来源:function.php


示例5: Fact2

/**
 * Write a real-valued function Fact2(N) that returns a double factorial N!!:
 * N!! = 1·3·5·…·N,    if N is an odd number;
 * N!! = 2·4·6·…·N    otherwise
 * (N is a positive integer; the real return type allows to avoid the integer
 * overflow during the calculation of the double factorials for large values of N).
 * Using this function, find the double factorials of five given integers.
 */
function Fact2($n)
{
    if ($n % 2 == 0) {
        $result = func($n);
        $result = 'even  ' . $result;
    } else {
        $result = func($n);
        $result = 'odd &nbsp; ' . $result;
    }
    return $result;
}
开发者ID:bamper,项目名称:TaskBook,代码行数:19,代码来源:35.php


示例6: foo4

function foo4()
{
    global $ar;
    foreach ($ar as $y) {
        func(12, new Dtor(), mt_rand(), func(mt_rand(), blar($y)));
    }
    try {
    } catch (Exception $x) {
        echo "Bad\n";
    }
}
开发者ID:badlamer,项目名称:hhvm,代码行数:11,代码来源:exception_bug_2080454.php


示例7: Dispatch

 function Dispatch()
 {
     $param = "/";
     $arr = array_diff($this->command->getParameters(), array(''));
     $param = $param . $this->command->getCommandName();
     foreach ($arr as $s) {
         $param = $param . "/" . $s;
     }
     $this->readyUrlRoute($this->url, $param);
     $this->controller->setParameters($this->command->getCommandName(), $this->command->getParameters());
     func(array($this->controller, $this->callback));
 }
开发者ID:jihun-kang,项目名称:a2bigPHP,代码行数:12,代码来源:Commanddispatcher.class.php


示例8: func

function func($id, $sd)
{
    $a = array();
    $db = new PDO('mysql:host=localhost;dbname=verse;charset=utf8', 'root', 'V3r5e');
    $stmt = $db->query('SELECT * from tree where parent=' . $id . ' and vid=' . $sd . '');
    if (isset($stmt)) {
        while ($line = $stmt->fetchAll(PDO::FETCH_ASSOC)) {
            foreach ($line as $col_val) {
                $a[] = array("name" => $col_val['name'], "children" => func($col_val['id'], $_GET['hari']));
            }
        }
    }
    return $a;
}
开发者ID:hribab,项目名称:projectverse,代码行数:14,代码来源:db.php


示例9: doSomething

 private function doSomething()
 {
     $this->has($this->nested("function calls!", 12.4));
     $var = 'single quoted string';
     $var->supports->dotNotation = "also" . "supports" . 'string' . $concatenation;
     $name = func(self::SOME_CONST);
     $name = func(self::$static_property);
     $do->somethingWith($this);
     $array_style_one = array('list', 'of', 4, $things);
     $nested_arrays = array('stuff', $with, array('stuff' => $between));
     $arrays = array('name' => 'russ', 'phone_number' => '1800flowers');
     $arrays[$foo] = 'bar';
     $var->supports($dotNotation, 'for functions!');
     return $x < $y ? true : false;
 }
开发者ID:russpos,项目名称:ppp,代码行数:15,代码来源:2.php


示例10: pleac_Interpolating_Functions_and_Expressions_Within_Strings

function pleac_Interpolating_Functions_and_Expressions_Within_Strings()
{
    #-----------------------------
    echo $var1 . func() . $var2;
    // scalar only
    #-----------------------------
    // PHP can only handle variable expression without operators
    // $answer = "STRING ${[ VAR EXPR ]} MORE STRING";
    #-----------------------------
    $phrase = "I have " . ($n + 1) . " guanacos.";
    // PHP cannot handle the complex exression: ${\($n + 1)}
    #-----------------------------
    // Rest of Discussion is not applicable to PHP
    #-----------------------------
    // Interpolating functions not available in PHP
    #-----------------------------
}
开发者ID:Halfnhav4,项目名称:pfff,代码行数:17,代码来源:Interpolating_Functions_and_Expressions_Within_Strings.php


示例11: allowed

 function allowed()
 {
     global $_allowed_;
     if (!session('id')) {
         if (!in_array(implode("-", module()) . func(), $_allowed_)) {
             $Base = new Base();
             $Base->type(ERROR);
             $Base->title(ERROR_MUST_LOGIN);
             $Base->header();
             $Base->footer();
             return false;
         } else {
             return true;
         }
     } else {
         return true;
     }
 }
开发者ID:jmichaelward,项目名称:pgBoard,代码行数:18,代码来源:Security.php


示例12: get_index

 function get_index()
 {
     $vars = array('isManager' => $this->can('manager'), 'can' => array(), 'user' => $this->user(false));
     $query = Order::with('manager')->name('o');
     Event::fire('order.list.query', array($query, $this, &$vars['can']));
     $rows = S::keys($query->get(), '?->id');
     if ($rows) {
         foreach ($rows as &$order) {
             $order->current = false;
         }
         $current = static::detectCurrentOrder();
         $current and $rows[$current->id]->current = true;
         Event::fire('order.list.populate', array(&$rows, $this, &$vars));
     }
     $vars['rows'] = func('to_array', $rows);
     Event::fire('order.list.vars', array(&$vars, $this));
     return $vars;
 }
开发者ID:SerdarSanri,项目名称:VaneMart,代码行数:18,代码来源:Order.php


示例13: gen

function gen()
{
    if ((yield $foo)) {
    } elseif ((yield $foo)) {
    }
    if ((yield $foo)) {
    } elseif ((yield $foo)) {
    }
    while ((yield $foo)) {
    }
    do {
    } while ((yield $foo));
    switch ((yield $foo)) {
    }
    (yield $foo);
    die((yield $foo));
    func((yield $foo));
    $foo->func((yield $foo));
    new Foo((yield $foo));
}
开发者ID:badlamer,项目名称:hhvm,代码行数:20,代码来源:yield_in_parenthesis.php


示例14: drawsolid

function drawsolid()
{
    global $p3;
    global $xmax;
    global $xmin;
    global $ymax;
    global $ymin;
    global $zmin;
    global $zmax;
    global $nxpoints;
    global $nypoints;
    Plot3D_clear($p3, BLACK);
    Plot3D_start($p3);
    $dx = 1.0 * ($xmax - $xmin) / $nxpoints;
    $dy = 1.0 * ($ymax - $ymin) / $nypoints;
    $cscale = 240.0 / ($zmax - $zmin);
    $x = $xmin;
    for ($i = 0; $i < $nxpoints; $i++) {
        $y = $ymin;
        for ($j = 0; $j < $nypoints; $j++) {
            $z1 = func($x, $y);
            $z2 = func($x + $dx, $y);
            $z3 = func($x + $dx, $y + $dy);
            $z4 = func($x, $y + $dy);
            $c1 = $cscale * ($z1 - $zmin);
            $c2 = $cscale * ($z2 - $zmin);
            $c3 = $cscale * ($z3 - $zmin);
            $c4 = $cscale * ($z4 - $zmin);
            $c = ($c1 + $c2 + $c3 + $c4) / 4;
            if ($c < 0) {
                $c = 0;
            }
            if ($c > 239) {
                $c = 239;
            }
            Plot3D_solidquad($p3, $x, $y, $z1, $x + $dx, $y, $z2, $x + $dx, $y + $dy, $z3, $x, $y + $dy, $z4, $c + 16);
            $y = $y + $dy;
        }
        $x = $x + $dx;
    }
}
开发者ID:sunaku,项目名称:swig-ruby-ffi,代码行数:41,代码来源:runme.php


示例15: pleac_Skipping_Selected_Return_Values

function pleac_Skipping_Selected_Return_Values()
{
    // The 'list' keyword [looks like a function but is actually a special language
    // construct] may be used to perform multiple assignments from a numerically
    // indexed array of values, and offers the added bonus of being able to skip
    // assignment of one, or more, of those values
    function func()
    {
        return array(3, 6, 9);
    }
    // ------------
    list($a, $b, $c) = array(6, 7, 8);
    // Provided 'func' returns an numerically-indexed array, the following
    // multiple assignment will work
    list($a, $b, $c) = func();
    // Any existing variables no longer wanted would need to be 'unset'
    unset($b);
    // As above, but second element of return array discarded
    list($a, , $c) = func();
    // ----------------------------
    // Care needed to ensure returned array is numerically-indexed
    list($dev, $ino, , , $uid) = array_slice(array_values(stat($filename)), 0, 13);
}
开发者ID:Halfnhav4,项目名称:pfff,代码行数:23,代码来源:Skipping_Selected_Return_Values.php


示例16: ini_set

/**
 * This file is part of Benchmark
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @author Nicolò Martini <[email protected]>
 */
include '../vendor/autoload.php';
ini_set('xdebug.var_display_max_depth', '10');
function func()
{
}
$func = 'func';
$bench = new \Nicmart\Benchmark\FixedSizeEngine();
$args = array_fill(0, 5, null);
$bench->register('direct', 'Direct call', function () use($args) {
    func($args[0], $args[1], $args[2], $args[3], $args[4]);
}, true)->register('cuf', 'call_user_func', function () use($args) {
    call_user_func('func', $args[0], $args[1], $args[2], $args[3], $args[4]);
}, true)->register('cufa', 'call_user_func_array', function () use($args) {
    call_user_func_array('func', $args);
});
$bench->benchmark(100);
$bench->benchmark(100);
$bench->benchmark(100);
$bench->benchmark(100);
$bench->benchmark(1000);
$groups[] = $bench->getResults();
$template = new \Nicmart\Benchmark\PHPTemplate();
echo $template->render(array('groups' => $groups));
开发者ID:nicmart,项目名称:benchmark,代码行数:31,代码来源:example.php


示例17: strlen

    {
        return strlen($str);
    }
    public static function instance()
    {
        return new self();
    }
    public function strlenFunction()
    {
        return 'strlen';
    }
}
function func()
{
    return array('func');
}
function test()
{
    return 'test';
}
testStrict(checkFunc('strlen')('four'), 4, 'func()()');
testStrict($checkFunc('strlen')('four'), 4, '$func()()');
testStrict(Test::checkFunc('strlen')('four'), 4, 'Class::method()()');
testStrict(Test::checkFunc(array('Test', 'strlen'))('four'), 4, 'Class::method(array(...))()');
testStrict(${$checkFunc}('strlen')('four'), 4, '$$func()()');
testStrict(Test::${$checkFunc}('strlen')('four'), 4, 'Class::$$method()()');
testStrict(Test::instance()->strlenFunction()('four'), 4, 'complex resolution');
testStrict(func()[0]()[0](), array('func'), 'func()[0]()[0]() (depends on arrayAccess)');
testStrict(test()()(), 'test', 'func()()()');
?>
</pre>
开发者ID:nikic,项目名称:prephp,代码行数:31,代码来源:funcRetCall.php


示例18: disp_order

function disp_order()
{
    $arr = array();
    $con = new mysqli("server29.000webhost.com", "a7914922_root", "1234asdf", "a7914922_hotels");
    $res = $con->query("select * from cart");
    $res1 = $con->query("select * from cart");
    global $i, $j;
    $i = 0;
    $row1 = $res1->fetch_assoc();
    $row1 = $res1->fetch_assoc();
    include 'cart.php';
    $rest_id = $row1['res_id'];
    $row = $res->fetch_assoc();
    echo "<br/><br/>USERNAME : " . $row['username'] . " <br/>";
    echo "<div class='container'><table class='table table-striped'>";
    echo "<th>ITEM</th>" . "<th>QTY</th>" . "<th>PRICE</th>" . "<th></th>";
    while ($row = $res->fetch_assoc()) {
        //$row = $res->fetch_assoc();
        echo "<tr>";
        $arr[$i] = $row['item'];
        $y = $row['item'];
        echo "<td>" . $row['item'] . "</td><td>" . $row['qty'] . "</td><td>" . $row['tot_price'] . "</td><td><button class='someclass btn btn-info' name='{$y}' value='{$y}'>Edit</button></td><td></td></tr>";
        $i++;
    }
    $j = $i;
    echo "</table></div><br/>";
    //echo $arr[0]."arr[0]";
    echo "<form method='post'>";
    $k = 0;
    echo " <div class='container'><button type='button' class='btn btn-info' data-toggle='collapse' data-target='#demo1' >Want to delete an item?</button><div id='demo1' class='collapse'>";
    while ($k < $j) {
        echo "<input type='checkbox' name='{$k}' value='{$arr[$k]}'> " . $arr[$k] . "<br><br>";
        $k++;
    }
    echo "<input type='submit' name='delete' value='Delete selected item'></form></div></div><br>";
    echo " <div class='container'><button type='button' class='btn btn-info' data-toggle='collapse' data-target='#demo3' >Add an item?</button><div id='demo3' class='collapse'>";
    echo "<br>Press back to add more items..</div></div>";
    if (isset($_POST['reorder'])) {
        func1($rest_id);
    }
    //if($rest_id ==3) echo "<button type='button' name='re-order' onclick='document.location.href='pbay.php''>RE-ORDER</button>";
    if (isset($_POST['delete'])) {
        func($i);
    }
}
开发者ID:Sayli-Karnik,项目名称:mywebsite,代码行数:45,代码来源:order.php


示例19: array_merge

            // 预定义一个用来存储转换值的空数组
            /* 将每一个传入的参数(非数组)组合成关联数组, 键名为 $defaults 数组的键名, 值为传入的参数 */
            for ($i = 0; $i < count($argInput); $i++) {
                if ($argInput[$i] == null || false) {
                    continue;
                }
                // 当参数为 null 或 false 时不转换并且丢弃该参数
                $argTrans[$defaultsKey[$i]] = $argInput[$i];
            }
            $arguments = array_merge($arguments, $defaults, $argTrans);
        }
    } else {
        $arguments = $defaults;
        // 入如果没有传入参数, 则使用默认值
    }
    return $arguments['name'] . ' is a ' . $arguments['role'] . '.' . "\n";
}
echo func(array('name' => 'Ayon', 'role' => 'Web Builder'));
// Ayon is a Web Builder.
echo func(array('name' => 'Ayon'));
// Ayon is a student.
echo func(array('role' => 'Web Builder'));
// Hyurl is a Web BUilder.
echo func('Ayon', 'Web Builder');
// Ayon is a Web Builder.
echo func('Ayon');
// Ayon is a student.
echo func(null, 'Web Builder');
// Hyurl is a Web Builder.
echo func();
// Hyurl is a student.
开发者ID:Hyurl,项目名称:phpExample,代码行数:31,代码来源:func_get_args.php


示例20: func

use Guzzle\Http\Message\Response;
function func($var)
{
    if (!$var) {
        $S3 = new S3Exception("hello word");
        $S3->setExceptionCode(400);
        $S3->setExceptionType("Client");
        $S3->setResponse(new Response(405));
        throw $S3;
    }
}
// 	$r = ObsClient::isValidBucketName("123");
// 	var_dump($r);
$client = ObsClient::factory(array('key' => 'C6840CE16E23C6F06EFF', 'secret' => 'RueC/EXFyvTbWGG6VkenF82w5pIAAAFNbiPG8EfN', 'endpoint' => 'http://129.7.182.2:5080', 'signature' => 's3'));
try {
    func(0);
} catch (S3Exception $e) {
    echo $e;
}
echo "--------------------------------\n";
//ssl认证
$client->setSslVerification(false, false, 0);
$resp = $client->listBuckets();
var_export($resp);
// 	$resp = $client->createBucket(array(
// 			'Bucket'=>'123456-2',
// 			'ACL'=>'log-delivery-write',
// 			'LocationConstraint'=>'abc'
// 	));
// 	var_export($resp);
// 	$resp = $client->HeadBucket(array(
开发者ID:eSDK,项目名称:esdk_obs_native_php,代码行数:31,代码来源:test.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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