本文整理汇总了PHP中process函数的典型用法代码示例。如果您正苦于以下问题:PHP process函数的具体用法?PHP process怎么用?PHP process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: process
#!/usr/bin/env php
<?php
/**
* This file is part of Slicer.
*
* Copyright (c) 2015 Tom Kaczocha <[email protected]>
*
* This Source Code is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at http://mozilla.org/MPL/2.0/.
*
* PHP version 5.6
*/
process(is_array($argv) ? $argv : []);
function process($argv)
{
$check = in_array('--check', $argv);
$help = in_array('--help', $argv);
$force = in_array('--force', $argv);
$quiet = in_array('--quiet', $argv);
$disableTls = in_array('--disable-tls', $argv);
$installDir = FALSE;
$version = FALSE;
$filename = 'slicer.phar';
$cafile = FALSE;
// --no-ansi wins over --ansi
if (in_array('--no-ansi', $argv)) {
define('USE_ANSI', FALSE);
} elseif (in_array('--ansi', $argv)) {
define('USE_ANSI', TRUE);
} else {
开发者ID:rawphp,项目名称:slicer,代码行数:31,代码来源:installer.php
示例17: console
if ($client < 0) {
console("socket_accept() failed");
continue;
} else {
connect($client);
}
} else {
$bytes = @socket_recv($socket, $buffer, 2048, 0);
if ($bytes == 0) {
disconnect($socket);
} else {
$user = getuserbysocket($socket);
if (!$user->handshake) {
dohandshake($user, $buffer);
} else {
process($user, $buffer);
}
}
}
}
}
//---------------------------------------------------------------
function process($user, $msg)
{
$action = unwrap($msg);
say("< " . $action);
switch ($action) {
case "hello":
send($user->socket, "hello human");
break;
case "hi":
开发者ID:GeorgeNava,项目名称:phpwebsocket,代码行数:31,代码来源:server.php
示例18: file
<?php
$input = file('input');
echo process($input), ' ', process($input, 1);
function process($input, $a = 0)
{
for ($i = 0, $c = count($input), $b = 0; $i < $c; $i++) {
$instr = substr($input[$i], 0, 3);
$split = explode(',', substr($input[$i], 4));
$r = trim($split[0]);
$val = isset($split[1]) ? trim($split[1]) : null;
if ($instr == 'hlf') {
${$r} /= 2;
} elseif ($instr == 'tpl') {
${$r} *= 3;
} elseif ($instr == 'inc') {
${$r}++;
} elseif ($instr == 'jmp') {
$i += $r - 1;
} elseif ($instr == 'jie' && ${$r} % 2 == 0) {
$i += $val - 1;
} elseif ($instr == 'jio' && ${$r} == 1) {
$i += $val - 1;
}
}
return $b;
}
开发者ID:earncef,项目名称:AdventOfCode,代码行数:27,代码来源:sol.php
示例19: process
$input = '1321131112';
function process($string)
{
$i = 1;
$total = strlen($string);
$digits = str_split($string);
$current = false;
$count = false;
$output = false;
foreach ($digits as $d) {
$last = $i === $total;
if ($current !== $d) {
if ($current) {
$output .= $count . $current;
}
$current = $d;
$count = 1;
} else {
$count++;
}
if ($last) {
$output .= $count . $current;
}
$i++;
}
return $output;
}
for ($i = 0; $i < 50; $i++) {
$input = process($input);
}
var_dump($input);
开发者ID:sergchernata,项目名称:Advent-of-Code,代码行数:31,代码来源:10.php
示例20: foreach
$select = QueryFactory::Build("select");
$select->Select("name", "frequency", "lastRun")->From("schedule");
$res = DatabaseManager::Query($select);
$res2 = $res->Result();
//fclose($myfile);//-----------------------------
// iterate through each task and proccess
if ($res->RowCount() > 1) {
// fwrite($myfile, "in first if\n");//------------------------
foreach ($res2 as $curr) {
// fwrite($myfile,"prosess\n");//--------------------------------
process($curr);
}
} else {
if ($res->RowCount() == 1) {
// fwrite($myfile ,"other prosess\n");//---------------------------------------
process($res2);
}
}
//fclose($myfile);
function process($curr)
{
echo $curr["name"] . ": ";
echo $curr["frequency"] . "<br>";
//if need to run task
if (strtotime($curr["frequency"], $curr["lastRun"]) < time()) {
//run job
include __DIR__ . '/' . $curr["name"];
//update last run time
$ran = QueryFactory::Build('update');
$ran->Table("schedule")->Set(["lastRun", time()])->Where(["name", '=', $curr["name"]]);
$success = DatabaseManager::Query($ran);
开发者ID:sam25,项目名称:website,代码行数:31,代码来源:scheduler.php
注:本文中的process函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论