本文整理汇总了PHP中printArray函数的典型用法代码示例。如果您正苦于以下问题:PHP printArray函数的具体用法?PHP printArray怎么用?PHP printArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printArray
function printArray($array, $title = null)
{
if ($title != null) {
echo "<h1>" . $title . "</h1>";
}
//fill table header
if (empty($array)) {
echo "No contents";
} else {
echo "<table border=1><tr>";
foreach ($array[0] as $key => $value) {
echo "<th>" . $key . "</th>";
}
echo "</tr>";
foreach ($array as $item) {
echo "<tr>";
foreach ($item as $key => $value) {
echo "<td>";
if (is_array($value)) {
printArray($value);
} elseif ($key == "Data") {
echo date('d/m/Y', strtotime($value));
} else {
echo $value;
}
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
}
}
示例2: getPath
/**
* Get path of this route
* @since Version 3.9
* @return array
*/
public function getPath()
{
$params = array("mode" => 0, "line" => $this->route_id);
$stops = $this->fetch("stops-for-line", $params);
printArray($this->url);
printArray($stops);
}
示例3: send
/**
* @param null $host - $host of socket server
* @param null $port - port of socket server
* @param string $action - action to execute in sockt server
* @param null $data - message to socket server
* @param string $address - addres of socket.io on socket server
* @param string $transport - transport type
* @return bool
*/
public function send($action = "message", $data = null, $address = "socket.io/?EIO=2", $transport = 'websocket')
{
$fd = fsockopen($this->hostname, $this->port, $errno, $errstr);
if (!$fd) {
throw new Exception("Could not establish connection to " . $this->hostname . ":" . $this->port);
}
$key = $this->generateKey();
$out = "GET {$address}&transport={$transport} HTTP/1.1\r\n";
$out .= "Host: http://{$host}:{$port}\r\n";
$out .= "Upgrade: WebSocket\r\n";
$out .= "Connection: Upgrade\r\n";
$out .= "Sec-WebSocket-Key: {$key}\r\n";
$out .= "Sec-WebSocket-Version: 13\r\n";
$out .= "Origin: *\r\n\r\n";
fwrite($fd, $out);
// 101 switching protocols, see if echoes key
$result = fread($fd, 10000);
preg_match('#Sec-WebSocket-Accept:\\s(.*)$#mU', $result, $matches);
printArray($result);
$keyAccept = trim($matches[1]);
$expectedResonse = base64_encode(pack('H*', sha1($key . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11')));
$handshaked = $keyAccept === $expectedResonse ? true : false;
if ($handshaked) {
fwrite($fd, $this->hybi10Encode('42["' . $action . '", "' . addslashes($data) . '"]'));
fread($fd, 1000000);
return true;
} else {
return false;
}
}
示例4: getContent
function getContent()
{
$s = "<div>";
$s .= printArray($this);
$s .= "</div>";
return $s;
}
示例5: printAny
function printAny($text)
{
if (is_array($text)) {
printArray($text);
} else {
printText($text);
}
}
示例6: __construct
/**
* Constructor
* @since Version 3.2
* @var object $db
* @var object $User
*/
public function __construct($User = false)
{
parent::__construct();
if (!$User || !$User->id || $User->id == NULL || empty($User->id)) {
throw new \Exception("Cannot instantiate " . __CLASS__ . " - user object is empty or not loaded" . printArray(debug_backtrace()));
}
$this->User = $User;
}
示例7: sortArrarTest
function sortArrarTest()
{
$number = array(10, 2, 10, 88, 7, 7, 3);
sort($number);
printArray($number);
rsort($number);
printArray($number);
}
示例8: printArray
function printArray($array)
{
foreach ($array as $key => $value) {
echo "{$key} => {$value}";
if (is_array($value)) {
//If $value is an array, print it as well!
printArray($value);
}
}
}
示例9: printArray
/**
* Определить рекурсивную функцию - аналог функции print_r
*/
function printArray(array &$arr)
{
if (key($arr) === null) {
reset($arr);
return 0;
} else {
echo '[' . key($arr) . ']' . ' => ' . current($arr) . '</br>';
next($arr);
printArray($arr);
}
reset($arr);
return 0;
}
示例10: init
function init()
{
if (isset($_SESSION["user"])) {
return;
}
$tk = C('tk');
echo $tk;
if (empty($tk)) {
return false;
}
printArray($_SESSION["user"]);
$user = new Users();
$auth = $user->AuthAuto($tk);
}
示例11: printArray
function printArray($array, $spaces = "")
{
$retValue = "";
if (is_array($array)) {
$spaces = $spaces . " ";
$retValue = $retValue . "<br/>";
foreach (array_keys($array) as $key) {
$retValue = $retValue . $spaces . "<strong>" . $key . "</strong>" . printArray($array[$key], $spaces);
}
$spaces = substr($spaces, 0, -30);
} else {
$retValue = $retValue . " - " . $array . "<br/>";
}
return $retValue;
}
示例12: show
function show()
{
header('Content-Type: text/html; charset=utf-8');
if ($this->context->state->zakaz->debug) {
//if (TRUE) {
//echo $this->getContent();
echo '<style> .active {font-weight: bold;} </style>';
$this->include_();
echo "<hr/>" . printArray($this);
} else {
include TEMPL . '/header.html';
$this->include_();
include TEMPL . '/footer.html';
}
}
示例13: echoBookList
/**
* Echo the list of videos in the specified feed.
*
* @param Zend_Gdata_Books_BookFeed $feed The video feed
* @return void
*/
function echoBookList($feed)
{
print <<<HTML
<table><tr><td id="resultcell">
<div id="searchResults">
<table class="volumeList"><tbody width="100%">
HTML;
$flipflop = false;
foreach ($feed as $entry) {
$title = printArray($entry->getTitles());
$volumeId = $entry->getVolumeId();
if ($thumbnailLink = $entry->getThumbnailLink()) {
$thumbnail = $thumbnailLink->href;
} else {
$thumbnail = null;
}
$preview = $entry->getPreviewLink()->href;
$embeddability = $entry->getEmbeddability()->getValue();
$creators = printArray($entry->getCreators());
if (!empty($creators)) {
$creators = "by " . $creators;
}
if ($embeddability == "http://schemas.google.com/books/2008#embeddable") {
$preview_link = '<a href="javascript:load_viewport(\'' . $preview . '\',\'viewport\');">' . '<img class="previewbutton" src="http://code.google.com/' . 'apis/books/images/gbs_preview_button1.png" />' . '</a><br>';
} else {
$preview_link = '';
}
$thumbnail_img = !$thumbnail ? '' : '<a href="' . $preview . '"><img src="' . $thumbnail . '"/></a>';
print <<<HTML
<tr>
<td><div class="thumbnail">
{$thumbnail_img}
</div></td>
<td width="100%">
<a href="{$preview}">{$title}</a><br>
{$creators}<br>
{$preview_link}
</td></tr>
HTML;
}
print <<<HTML
</table></div></td>
<td width=50% id="previewcell"><div id="viewport"></div>
</td></tr></table><br></body></html>
HTML;
}
示例14: SuggestEvents
/**
* Suggest events to tag
* @since Version 3.10.0
* @param \Railpage\Images\Image $imageObject
* @return array
*/
public static function SuggestEvents(Image $imageObject)
{
if (!$imageObject->DateCaptured instanceof DateTime) {
return;
}
$Database = (new AppCore())->getDatabaseConnection();
$query = "SELECT COUNT(*) AS num FROM image_link WHERE namespace = ? AND image_id = ?";
$params = [(new Event())->namespace, $imageObject->id];
if ($Database->fetchOne($query, $params) > 0) {
return;
}
$Events = new Events();
$list = $Events->getEventsForDate($imageObject->DateCaptured);
foreach ($list as $k => $row) {
$Event = new Event($row['event_id']);
printArray($Event->namespace);
die;
$list[$k]['url'] = sprintf("/services?method=railpage.image.tag&image_id=%d&object=%s&object_id=%d", $imageObject->id, "\\Railpage\\Events\\Event", $row['event_id']);
}
return $list;
}
示例15: printArray
function printArray($arr)
{
if (!is_object($arr) and !is_array($arr)) {
return $arr;
} else {
if (is_object($arr)) {
$s = "Object: " . get_class($arr) . "<ul>";
foreach (get_object_vars($arr) as $key => $value) {
$s .= "<li>" . $key . " = " . printArray($value) . "</li>";
}
$s .= "</ul>";
return $s;
} else {
$s = "Array: <ul>";
foreach ($arr as $key => $value) {
$s .= "<li>" . $key . " = " . printArray($value) . "</li>";
}
$s .= "</ul>";
return $s;
}
}
}