当前位置: 首页>>代码示例>>PHP>>正文


PHP process函数代码示例

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


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

示例1: process

function process($s)
{
    $bidx = strpos($s, '(');
    while ($bidx !== FALSE) {
        $count = 1;
        $eidx = $bidx + 1;
        for (; $count; $eidx++) {
            if ($s[$eidx] == '(') {
                $count++;
            }
            if ($s[$eidx] == ')') {
                $count--;
            }
        }
        $s = substr($s, 0, $bidx) . process(substr($s, $bidx + 1, $eidx - 1 - ($bidx + 1))) . substr($s, $eidx);
        $bidx = strpos($s, '(');
    }
    $matches = null;
    while (preg_match("/^(.*?)(-?\\d+)([*\\/])(-?\\d+)(.*)\$/", $s, $matches)) {
        if ($matches[3] == '*') {
            $s = $matches[1] . $matches[2] * $matches[4] . $matches[5];
        } else {
            $s = $matches[1] . intval($matches[2] / $matches[4]) . $matches[5];
        }
    }
    while (preg_match("/^(.*?)(-?\\d+)([+Z])(-?\\d+)(.*)\$/", $s, $matches)) {
        if ($matches[3] == '+') {
            $s = $matches[1] . ($matches[2] + $matches[4]) . $matches[5];
        } else {
            $s = $matches[1] . ($matches[2] - $matches[4]) . $matches[5];
        }
    }
    return $s;
}
开发者ID:AbhiNki,项目名称:procon,代码行数:34,代码来源:tyama_doujo76.php

示例2: process

function process(DOMNode $current_node)
{
    global $filter_args, $filter_tags, $filter_mandatory, $bbcode;
    if ($current_node instanceof DOMElement || $current_node instanceof DOMDocument) {
        // Recursion. I need iterator_to_array(), because it's likely
        // that node list will be modified.
        foreach (iterator_to_array($current_node->childNodes) as $node) {
            process($node);
        }
        // BBCode hack is NOT allowed to exist
        if ($current_node->tagName === 'bbcodehack') {
            $value = $current_node->hasAttribute('value') ? $current_node->getAttribute('value') : NULL;
            $nodes = $current_node->hasAttribute('pre') ? $current_node->getAttribute('pre') : $current_node->childNodes;
            $nodes = $bbcode[$current_node->getAttribute('name')]['callback']($current_node->ownerDocument, $nodes, $value, array('borked' => $current_node->hasAttribute('borked')));
            if (!is_array($nodes)) {
                $nodes = array($nodes);
            }
            foreach ($nodes as $node) {
                $current_node->parentNode->insertBefore($node, $current_node);
            }
            // Remove bbcodehack from DOM
            $current_node->parentNode->removeChild($current_node);
        } elseif ($current_node->tagName && !isset($filter_tags[$current_node->tagName])) {
            while ($current_node->hasChildNodes()) {
                $current_node->parentNode->insertBefore($current_node->childNodes->item(0), $current_node);
            }
            $current_node->parentNode->removeChild($current_node);
        } else {
            if ($current_node->hasAttributes()) {
                // I need iterator_to_array, as I modify attributes
                // list while iterating.
                foreach (iterator_to_array($current_node->attributes) as $attr) {
                    $attribute = isset($filter_tags[$current_node->tagName][$attr->name]) ? $filter_tags[$current_node->tagName][$attr->name] : (isset($filter_args[$attr->name]) ? $filter_args[$attr->name] : NULL);
                    if (!$attribute) {
                        $current_node->removeAttribute($attr->name);
                    } elseif (!is_bool($attribute)) {
                        $value = $attribute($attr->value, $current_node);
                        if ($value === NULL) {
                            $current_node->removeAttribute($attr->name);
                        } else {
                            $current_node->setAttribute($attr->name, $value);
                        }
                    }
                }
            }
            if (isset($filter_mandatory[$current_node->tagName])) {
                foreach ($filter_mandatory[$current_node->tagName] as $attr => $value) {
                    if (!$current_node->hasAttribute($attr)) {
                        $current_node->setAttribute($attr, $value);
                    }
                }
            }
        }
    } elseif ($current_node instanceof DOMComment) {
        // Unsafe because of conditional comments
        $current_node->parentNode->removeChild($current_node);
    }
}
开发者ID:knytrune,项目名称:ABXD,代码行数:58,代码来源:htmlfilter.php

示例3: process

function process(\CompositeElement $elementObject, $level)
{
    $level++;
    echo $level . ': ' . $elementObject . '<br/>';
    if (count($elementObject) > 0) {
        foreach ($elementObject as $elementChildObject) {
            process($elementChildObject, $level);
        }
    }
}
开发者ID:naucon,项目名称:utility,代码行数:10,代码来源:CompositeExample.php

示例4: process

function process(&$inputs, $length, $total, &$count, &$ways, $i = 0, $number = 0)
{
    if ($total == 0) {
        return $count++ && ($ways[$number] = isset($ways[$number]) ? $ways[$number] + 1 : 1);
    }
    if ($i >= $length || $total < 0) {
        return;
    }
    process($inputs, $length, $total - $inputs[$i], $count, $ways, $i + 1, $number + 1);
    process($inputs, $length, $total, $count, $ways, $i + 1, $number);
}
开发者ID:earncef,项目名称:AdventOfCode,代码行数:11,代码来源:sol.php

示例5: input

function input()
{
    #Prompt user
    if (PHP_OS == 'WINNT') {
        echo "> ";
        $line = stream_get_line(STDIN, 1024, PHP_EOL);
    } else {
        $line = readline("> ");
    }
    #Pass input to switch function
    process($line);
}
开发者ID:Whitecaribou,项目名称:tybot,代码行数:12,代码来源:tybot.php

示例6: process

function process($data)
{
    global $val;
    if (is_object($data) || is_array($data)) {
        foreach ($data as $datum) {
            process($datum);
        }
    } else {
        if (is_integer($data)) {
            $val += $data;
        }
    }
}
开发者ID:monodesigns,项目名称:adventofcode,代码行数:13,代码来源:day12.php

示例7: process

function process($commit)
{
    global $commits, $ordered;
    if (!count($commits[$commit]['parents'])) {
        $ordered[] = $commits[$commit]['commit'];
        foreach ($commits[$commit]['children'] as $child) {
            $commits[$child]['parents'] = array_filter($commits[$child]['parents'], function ($parent) use($commit) {
                return $parent !== $commit;
            });
            process($child);
        }
    }
}
开发者ID:BastinRobin,项目名称:CodeSprints,代码行数:13,代码来源:sv.accepted.php

示例8: process

function process($base, $array)
{
    $principal = function ($internalBase, $internalValue) {
        $pathBuffer = $internalBase . $internalValue . '/development/';
        $styleBuffer = minify($pathBuffer);
        echo $pathBuffer;
        $pathFile = $internalBase . $internalValue . '/output/import-' . $internalValue . '.min.css';
        writting($pathFile, $styleBuffer);
    };
    foreach ($array as $key => $value) {
        if (!is_array($value)) {
            $principal($base, $value);
        } else {
            $principal($base, $key);
            process($base . $key . '/', $value);
        }
    }
}
开发者ID:hevelmo,项目名称:compress,代码行数:18,代码来源:index.php

示例9: search

function search($expression, $from, $count, $lang)
{
    global $applServer, $output;
    $from = $from != "" ? $from : "1";
    $count = $count != "" ? $count : "10";
    if ($lang == "es") {
        $iahLang = "e";
    } else {
        if ($lang == "en") {
            $iahLang = "i";
        } else {
            $iahLang = "p";
        }
    }
    $serviceUrl = "http://" . $applServer . "/cgi-bin/wxis.exe/iah/?IsisScript=iah/iah.xis&base=article^dlibrary&exprSearch=" . $expression . "&lang=" . $iahLang . "&nextAction=xml&isisFrom=" . $from . "&count=" . $count . "&fmt=citation";
    $redirectHtml = "http://" . $applServer . "/cgi-bin/wxis.exe/iah/?IsisScript=iah/iah.xis&base=article^dlibrary&exprSearch=" . $expression . "&lang=" . $iahLang . "&nextAction=lnk&isisFrom=" . $from . "&count=" . $count;
    $response = process($serviceUrl, $redirectHtml);
    return $response;
}
开发者ID:robertatakenaka,项目名称:Proceedings,代码行数:19,代码来源:index.php

示例10: process

function process($nid, &$pages, &$obj, &$counters)
{
    $incremented = array();
    foreach ($pages[$nid] as $o) {
        $type = $o["#type"];
        if ($type == "link") {
            process($o["#link"], $pages, $obj, $counters);
            continue;
        }
        $objProps = $obj[$type];
        $counter = $lowest = $objProps["#counter"];
        $fixed = $objProps["#fixed"];
        if (!$fixed) {
            if (!isset($incremented[$counter])) {
                $last = $lowest = $counter;
                for (; $lowest != null && $counters[$lowest]["value"] == 0; $lowest = $counters[$lowest]["parent"]) {
                    $last = $lowest;
                }
                $lowest = $last;
                $incremented[$counter] = array("#level" => $lowest);
            } else {
                $lowest = $incremented[$counter]["#level"];
            }
        }
        if (isset($counters[$lowest]["children"])) {
            if (!isset($history)) {
                $history = array_merge(array(), $counters);
            }
            foreach ($counters[$lowest]["children"] as $child) {
                $counters[$child]["value"] = 0;
            }
        }
        $counters[$lowest]["value"]++;
        echo getLabel($counters, $lowest) . " - " . $o["#title"] . "<br/>";
    }
    foreach ($incremented as $key => $val) {
        $lowest = $val["#level"];
        $counters[$lowest]["value"] = 0;
    }
    if (isset($history)) {
        $counters = $history;
    }
}
开发者ID:holtzermann17,项目名称:drupal_planetary,代码行数:43,代码来源:book_counter_algo.php

示例11: process

function process($places, $route = array(), $total = 0)
{
    global $all, $nodes, $min, $minroute, $max, $maxroute;
    foreach ($places as $place => $distance) {
        if (count($route) == $all) {
            if ($min > $total) {
                $minroute = $route;
                $min = $total;
            } else {
                if ($max < $total) {
                    $maxroute = $route;
                    $max = $total;
                }
            }
            return;
        }
        if (in_array($place, $route)) {
            continue;
        }
        process($nodes[$place], array_merge($route, array($place)), $total + $distance);
    }
}
开发者ID:altef,项目名称:AdventOfCode,代码行数:22,代码来源:Day9.php

示例12: FT_load

function FT_load()
{
    $config = (require_once PATH_APPLICATION . '/config/init.php');
    autoDeleteFile();
    $arrayUrl = parseUrl();
    if (!empty($_SESSION['name'])) {
        process();
    } else {
        if (!empty($_COOKIE['name'])) {
            $_SESSION['name'] = $_COOKIE['name'];
            $_SESSION['id'] = $_COOKIE['id'];
            $_SESSION['avatar'] = $_COOKIE['avatar'];
        } else {
            if ($arrayUrl[0] == 'user' && $arrayUrl[1] == 'login') {
                $controllerObject = new User_Controller();
                $controllerObject->login();
            } else {
                headerUrl('/user/login');
            }
        }
    }
}
开发者ID:anhnt36,项目名称:duan,代码行数:22,代码来源:FT_Common.php

示例13: check

function check()
{
    $dmenu = def_menu();
    $menu = array('Home' => array('Home' => ''), 'Account' => array('Rewards' => 'mpayouts', 'Payments' => 'payments', 'Settings' => 'settings', 'User Settings' => 'userset', '2FA Settings' => '2fa'), 'Workers' => array('Shifts' => 'shifts', 'Shift Graph' => 'usperf', 'Workers' => 'workers', 'Management' => 'workmgt'), 'Pool' => array('Stats' => 'stats', 'Blocks' => 'blocks', 'Graph' => 'psperf', 'Acclaim' => 'userinfo', 'Luck' => 'luck'), 'Admin' => NULL, 'gap' => array('API' => 'api', 'PBlocks' => 'pblocks'), 'Help' => array('Payouts' => 'payout'));
    tryLogInOut();
    $who = loggedIn();
    if ($who === false) {
        $p = getparam('k', true);
        if ($p == 'reset') {
            showPage(NULL, 'reset', $dmenu, '', $who);
        } else {
            if (requestLoginRegReset() == true) {
                showPage(NULL, 'reg', $dmenu, '', $who);
            } else {
                $p = getparam('k', true);
                process($p, $who, $dmenu);
            }
        }
    } else {
        $p = getparam('k', true);
        process($p, $who, $menu);
    }
}
开发者ID:nullivex,项目名称:ckpool,代码行数:23,代码来源:prime.php

示例14: markQuiz

require_once __DIR__ . "/../../../vendor/autoload.php";
$DB = Database::singleton();
// Get the ID for the instrument that was selected
$instrumentID = $_REQUEST['instrument'];
$quizCorrect = markQuiz($instrumentID);
if ($quizCorrect == false) {
    print "incorrect";
    exit;
} else {
    $user = User::singleton();
    $userFullName = $user->getFullname();
    $userCenter = $user->getCenterID();
    $examinerID = $DB->pselectOne("SELECT examinerID \n         FROM examiners\n         WHERE full_name=:FN AND centerID=:CID", array('FN' => $userFullName, 'CID' => $userCenter));
    $dateArray = array('Y' => date('Y'), 'M' => date('m'), 'd' => date('d'));
    $values = array('pass' => array($instrumentID => 'certified'), 'date_cert' => array($instrumentID => $dateArray), 'examiner' => $examinerID);
    process($values);
    print "correct";
    exit;
}
/**
 * Determines if an answer is correct for a question from the training quiz
 *
 * @param string $instrumentID The ID of the instrument
 * @param string $question     The question number
 * @param string $answer       The answer number provided by the user
 *
 * @return int
 */
function correct($instrumentID, $question, $answer)
{
    $DB = Database::singleton();
开发者ID:frankbiospective,项目名称:Loris,代码行数:31,代码来源:markQuiz.php

示例15: switch

<?php

$method = $_SERVER['REQUEST_METHOD'];
switch ($method) {
    case 'POST':
        $request = $_POST;
        $result = process($request);
        echo json_encode($result);
        break;
    case 'GET':
        //process($request);
        break;
    case 'PUT':
        //do_something_with_put($request);
        break;
    case 'HEAD':
        //do_something_with_head($request);
        break;
    case 'DELETE':
        //do_something_with_delete($request);
        break;
    case 'OPTIONS':
        //do_something_with_options($request);
        break;
    default:
        //handle_error($request);
        break;
}
function process($data)
{
    $result = ValidateKey($data);
开发者ID:pratikm23,项目名称:Publishing-frontend,代码行数:31,代码来源:json.php


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