本文整理汇总了PHP中func函数的典型用法代码示例。如果您正苦于以下问题:PHP func函数的具体用法?PHP func怎么用?PHP func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了func函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例2: funcfunc
function funcfunc()
{
try {
func();
} catch (Exception $ex) {
throw $ex;
}
}
示例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";
}
示例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";
}
示例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 ' . $result;
}
return $result;
}
示例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";
}
}
示例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));
}
示例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;
}
示例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;
}
示例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
#-----------------------------
}
示例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;
}
}
示例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;
}
示例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));
}
示例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;
}
}
示例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);
}