本文整理汇总了PHP中tail函数的典型用法代码示例。如果您正苦于以下问题:PHP tail函数的具体用法?PHP tail怎么用?PHP tail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readConfig
/**
* @param array $files Configuration files, from lowest to highest precedence.
* @return array An associative array mapping config variables to respective values.
*/
function readConfig(array $files)
{
if (count($files) == 0) {
return array();
} else {
return array_merge(parse_ini_file(head($files)), readConfig(tail($files)));
}
}
示例2: partial
/**
* @author Sérgio Rafael Siqueira <sergio@inbep.com.br>
*
* @param callable $fn
*
* @return mixed
*/
function partial(callable $fn)
{
$args = tail(func_get_args());
$numRequiredParams = (new \ReflectionFunction($fn))->getNumberOfRequiredParameters();
return function () use($fn, $args, $numRequiredParams) {
$args = array_merge($args, func_get_args());
if ($numRequiredParams > count($args)) {
return call_user_func_array(partial, array_merge([$fn], $args));
}
return call_user_func_array($fn, $args);
};
}
示例3: sort
/**
* @author Sérgio Rafael Siqueira <sergio@inbep.com.br>
*
* @param array $xss
*
* @return array
*/
function sort(array $xss)
{
$xss = array_values($xss);
if (!has(1, $xss)) {
return $xss;
}
$pivot = head($xss);
$xs = tail($xss);
$left = array_filter($xs, function ($x) use($pivot) {
return $x < $pivot;
});
$right = array_filter($xs, function ($x) use($pivot) {
return $x > $pivot;
});
return array_merge(sort($left), [$pivot], sort($right));
}
示例4: takewhile
/**
* @author Marcelo Camargo <marcelocamargo@linuxmail.org>
* @author Sérgio Rafael Siqueira <sergio@inbep.com.br>
*
* @return array
*/
function takewhile()
{
$args = func_get_args();
$takewhile = function (callable $condition, array $xss) {
if ([] === $xss) {
return [];
}
$head = head($xss);
$tail = tail($xss);
if ($condition($head)) {
return array_merge([$head], takewhile($condition, $tail));
}
return [];
};
return call_user_func_array(partial($takewhile), $args);
}
示例5: dropwhile
/**
* @author Sérgio Rafael Siqueira <sergio@inbep.com.br>
*
* @return array
*/
function dropwhile()
{
$args = func_get_args();
$dropwhile = function (callable $condition, array $xss) {
if ([] === $xss) {
return [];
}
$head = head($xss);
$tail = tail($xss);
if ($condition($head)) {
return dropwhile($condition, $tail);
}
return $xss;
};
return call_user_func_array(partial($dropwhile), $args);
}
示例6: live_chat_load_events
function live_chat_load_events($options)
{
$tail['filename'] = LIVE_CHAT_STORAGE_PATH . $options['type'] . '/' . $options['reference_id'];
$tail['line_count'] = LIVE_CHAT_MAX_READ_LINES;
$tail['buffer_length'] = LIVE_CHAT_STORAGE_BUFFER_LENGTH;
$options['min_id'] = isset($options['min_id']) ? $options['min_id'] : 0;
$rows = tail($tail);
$events = array();
foreach ($rows as $row) {
$event = unserialize(trim($row));
if ($event['id'] > $options['min_id']) {
$event['message'] = clickable_links($event['message']);
$event['message'] = setsmilies($event['message']);
$events[] = $event;
}
}
return $events;
}
示例7: changeComplete
function changeComplete($type = "Information", $note = "")
{
session_destroy();
head();
?>
<section><div class="container">
<h1><?php
echo $type;
?>
Changed!</h1>
<p>Success! Please re-login to continue.</p>
<p><?php
echo $note;
?>
</p>
</div></section>
<?php
tail();
die;
}
示例8: setData
function setData($DATABASE)
{
$db = new DB();
$values = [];
foreach ($_POST as $value) {
array_push($values, $db->quote($value));
}
$valuesString = "(" . implode(", ", $values) . ")";
$db->query("INSERT INTO " . $DATABASE . ".feedback \n\t\t (type, text, email) \n\t\t VALUES " . $valuesString);
head();
?>
<div class="container">
<h1>Thank you for your feedback!</h1>
<p>Your feedback has been successfuly saved.</p>
</div>
<?php
tail();
die;
}
示例9: verifyUser
function verifyUser($email, $code, $DATABASE)
{
$db = new DB();
$exists = $db->select("SELECT * \n\t FROM " . $DATABASE . ".users \n\t WHERE email = " . $db->quote($email) . " AND activation = " . $db->quote($code));
if (empty($exists[0])) {
error("Invalid Verification", "Your verification is invalid. You might already be verified.");
} else {
//TODO this is copied into preferences for updateing email
if (preg_match("/((@uw\\.edu)|(@u\\.washington\\.edu))/i", $exists[0]["email"])) {
$netid = substr($exists[0]["email"], 0, strpos($exists[0]["email"], "@"));
$db->query("UPDATE " . $DATABASE . ".users\n\t\t\t SET activation = '1', netid = " . $db->quote($netid) . " WHERE email = " . $db->quote($email));
} else {
$db->query("UPDATE " . $DATABASE . ".users\n\t\t\t SET activation = '1', netid = NULL\n\t\t\t WHERE email = " . $db->quote($email));
}
head();
?>
<section class="content">
<div class="container">
<h1>Success!</h1>
<p>You are now verified with the Experimental College!
Sign up for some classes!</p>
</div>
</section>
<?php
tail();
}
}
示例10: tail
echo $lines == '100' ? 'selected' : '';
?>
>100</option>
<option value="500" <?php
echo $lines == '500' ? 'selected' : '';
?>
>500</option>
</select>
</form></p>
</div>
<div class="content">
<code><pre style="font-size:14px;font-family:monospace;color:black;white-space: inherit"><ol reversed>
<?php
$output = tail($file, $lines);
$output = explode("\n", $output);
if (DISPLAY_REVERSE) {
// Latest first
$output = array_reverse($output);
}
foreach ($output as $out) {
if (trim($out) != '') {
echo '<li>' . htmlspecialchars($out) . '</li>';
}
}
?>
</ol></pre>
</code>
<footer>
<p> berndklaus.at Log-Parser </p>
示例11: benchTail
public function benchTail()
{
return tail($this->words());
}
示例12: loadchat
function loadchat($name)
{
$file = CHATDIR . $name . '.log';
if (!file_exists($file)) {
file_put_contents($file, "");
}
// UTF-8 BOM Support
$line = tail($file, 5);
return nl2br($line);
}
示例13: make
<?php
/*
* This file is part of the async generator runtime project.
*
* (c) Julien Bianchi <contact@jubianchi.fr>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
require_once __DIR__ . '/../../vendor/autoload.php';
use function jubianchi\async\loop\{endless};
use function jubianchi\async\pipe\{make};
use function jubianchi\async\runtime\{await, all};
use function jubianchi\async\socket\{write};
use function jubianchi\async\stream\{tail};
$pipe = make();
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, 0, $argv[1]);
socket_set_nonblock($socket);
await(all(tail(fopen(__DIR__ . '/../data/first.log', 'r'), $pipe), tail(fopen(__DIR__ . '/../data/second.log', 'r'), $pipe), endless(function () use($socket, $pipe) {
$data = (yield from $pipe->dequeue());
yield from write($socket, $data);
})));
示例14: sql_query
$result_rows = sql_query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST" . $order_by);
foreach ($result_rows as $row) {
foreach ($row as $cell) {
if (stripos($cell, $filter) !== false) {
array_push($results, $row);
break;
}
}
}
}
// $actions = array("Kill" => "stuff"); /* for future implementation */
$sorted = true;
break;
case "sqllogtransactions":
if (isset($mysql_log_transactions) && isset($mysql_log_location) && file_exists($mysql_log_location) && is_readable($mysql_log_location)) {
$data = tail($mysql_log_location, 1000);
$lines = array();
foreach (preg_split('/\\n/', $data) as $line) {
$line = trim($line);
if ($line == "") {
continue;
}
array_push($lines, $line);
}
for ($i = count($lines) - 1; $i >= 0; $i--) {
if ($filter == "" || stripos($lines[$i], $filter) !== false) {
$entry = array("Tail" => count($lines) - $i, "Line" => $lines[$i]);
array_push($results, $entry);
}
}
} else {
示例15: resetCompletePage
function resetCompletePage()
{
session_start();
session_destroy();
//in case a user was logged in when they reset password
head();
?>
<section class="content">
<div class="container">
<h1>Password Reset!</h1>
<p>Your password has been reset. Please
<a href="/asuwxpcl/users/login.php">login</a> to continue</p>
</div>
</section>
<?php
tail();
}