本文整理汇总了PHP中print_array函数的典型用法代码示例。如果您正苦于以下问题:PHP print_array函数的具体用法?PHP print_array怎么用?PHP print_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_array
function print_array($data_, $n_ = 0)
{
if (is_array($data_)) {
foreach ($data_ as $k => $v) {
for ($i = 0; $i < $n_; $i++) {
echo '.';
}
echo "<strong>{$k}</strong> => { ";
if (is_array($v)) {
echo "<br />\n";
print_array($v, $n_ + 4);
for ($i = 0; $i < $n_; $i++) {
echo '.';
}
echo " }<br />\n";
} else {
echo $v . " }<br />\n";
}
}
} else {
for ($i = 0; $i < $n_; $i++) {
echo '.';
}
echo $data_ . "<br>\n";
}
}
示例2: drawline_handle_fatal
function drawline_handle_fatal()
{
$error = error_get_last();
if ($error !== NULL) {
print_array($error);
}
}
示例3: print_array
function print_array($array)
{
$result = '';
foreach ($array as $b => $param) {
$result .= "<br/> {$b} => ";
try {
if (is_array($param)) {
$result .= print_array($param);
} else {
if (is_object($param)) {
$result .= print_r($param);
} else {
if (is_string($param)) {
$result .= $param;
} else {
$result .= print_r($param);
}
}
}
} catch (Exception $e) {
$result .= print_r($e);
}
}
return $result;
}
示例4: print_power_sets
function print_power_sets($arr)
{
echo "POWER SET of [" . join(", ", $arr) . "]<br>";
foreach (power_set($arr) as $subset) {
print_array($subset);
}
}
示例5: test_from_wx_3g
function test_from_wx_3g()
{
// print_r($_SERVER);
$array = getallheaders();
// print_r($array);
print_array($array);
}
示例6: print_array
function print_array( $array ) {
$result = '';
foreach( $array as $b => $param)
if ( is_array($param) )
$result .= print_array( $param );
else
$result .= "$b => $param<br/>";
return $result;
}
示例7: merge_sort
function merge_sort(&$a, $l = 0, $r = -1, $tmp_v = array())
{
// gestisce la prima chiamata, quella senza argomenti
if ($r == -1) {
$r = count($a) - 1;
$tmp_v = $a;
}
// Distingue i casi elementari (1 o 2 elementi)
if ($l == $r) {
$pa = array_slice($a, $l, $r - $l + 1);
print_array($pa, "Dividi - caso elementare 1 elemento", "({$l} {$r})");
} elseif ($r == $l + 1) {
$pa = array_slice($a, $l, $r - $l + 1);
print_array($pa, "Dividi - caso elementare 2 elementi", "({$l} {$r})");
if ($a[$l] > $a[$r]) {
$tmp = $a[$r];
$a[$r] = $a[$l];
$a[$l] = $tmp;
}
$pa = array_slice($a, $l, $r - $l + 1);
print_array($pa, "Ordina - caso elementare 2 elementi", "({$l} {$r})");
} elseif ($l != $r) {
// Caso non elementare
$pa = array_slice($a, $l, $r - $l + 1);
print_array($pa, "Dividi - caso non elementare elementi", "({$l} {$r})");
$center = round(($l + $r) / 2, 0, PHP_ROUND_HALF_DOWN);
merge_sort($a, $l, $center);
merge_sort($a, $center + 1, $r);
}
// merge
$n = $r - $l + 1;
$c = round($n / 2, 0);
for ($i = 0; $i < $n; $i++) {
$tmp_v[$i] = $a[$l + $i];
}
$i = $j = 0;
while ($i < $c && $j < $n - $c) {
if ($tmp_v[$i] < $tmp_v[$c + $j]) {
$a[$l + $i + $j] = $tmp_v[$i];
$i++;
} else {
$a[$l + $i + $j] = $tmp_v[$c + $j];
$j++;
}
}
while ($i < $c) {
$a[$l + $i + $j] = $tmp_v[$i];
$i++;
}
$pa = array_slice($a, $l, $r - $l + 1);
print_array($pa, "Fondi ", "({$l} {$r})");
}
示例8: printDebug
/**
//作者:Zerolone
//日期:20060306
//修改:20070421 -- 添加变量调试信息
//功能:显示调试信息
//返回:
*/
function printDebug()
{
global $totaltime, $query_count, $show_queries, $query_log;
$ThisPage = $_SERVER['PHP_SELF'];
//变量调试信息 20070421
$variable_log = "本页得到的_GET变量有:\n" . print_array($_GET);
$variable_log .= "本页得到的_POST变量有:\n" . print_array($_POST);
$variable_log .= "本页得到的_COOKIE变量有:\n" . print_array($_COOKIE);
$variable_log .= "本页得到的_SESSION变量有:\n" . print_array(@$_SESSION);
$variable_log .= "HTTP头文件:\n" . print_array(getallheaders());
//
return "当前页面为:{$ThisPage} [<a href=\"javascript:history.go(0);\">刷新该页面</a>]\n\t <script language=\"javascript\" type=\"text/javascript\">\n\t\tfunction showdebug(span_show, span_source)\n\t\t{\n\t\t\tvar TheImg;\n\t\t\tspan_show\t= eval(span_show);\n\t \t\tspan_source\t= eval(span_source)\n\t\t\n\t\t\tif(span_show.style.display == \"none\")\n\t\t\t{\n\t\t\t\tspan_show.style.display = \"\";\n\t \t\t\tspan_source.innerHTML\t= \"<font color=\\'blue\\'>关闭</font>调试信息\"; \n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tspan_show.style.display = \"none\";\n\t \t\t\tspan_source.innerHTML\t= \"<font color=\\'red\\'>打开</font>调试信息\"; \n\t\t\t}\n\t\t}\n\t </script>\n\t <span id=debug_source onClick=showdebug('debug_show','debug_source')><font color=\"red\">打开</font>调试信息</span><br>\n\t <!-- <span id=debug_source onClick=showdebug('debug_show','debug_source')><font color=\"blue\">关闭</font>调试信息</span><br> -->\n\t <div align=\"left\"><span id=debug_show style=\"display=none\">\n\t\t\t\t<textarea style='width=800;height=500' cols='100' rows='8'>{$query_log}{$variable_log}</textarea>\n\t </span>\n\t </div>\n\t ";
}
示例9: dev_dump
function dev_dump($argument, $heading = "", $dev = 1, $query_trigger = 0)
{
//print_r($_SERVER);
//allows the whole lot to be switched off
$all_off = 0;
//allows every dev dump encountered to be switched on
$all_on = 0;
if ($dev && !$all_off || $all_on) {
if (is_array($argument)) {
echo "<div style='width:95%; float:left; position:relative; background-color:#fff; z-index:1000000; margin-bottom:20px; padding:2%; border:1px solid #4242ff; color:#4242ff; border-radius:2px;'>";
if ($query_trigger) {
echo "<span class='dd_q_out full_screen_width bold'><strong>" . $heading . "</strong></span>";
} else {
echo "<span>ARRAY DUMP - <strong>" . $heading . "</strong></span><br/><br/>";
}
echo "<span class='dd_a_out full_screen_width'>";
print_array("", $argument);
echo "</span>";
echo "</div>";
} else {
if (is_numeric($argument)) {
echo "<div style='width:95%; float:left; position:relative; background-color:#fff; z-index:1000000; margin-bottom:20px; padding:2%;border:1px solid #bf42bf; color:#bf42bf; border-radius:2px;'>";
$type = 'NUMBER';
} else {
if (is_null($argument)) {
echo "<div style='width:95%; float:left; position:relative; background-color:#fff; z-index:1000000; margin-bottom:20px; padding:2%;border:1px solid #ff4242; color:#ff4242; border-radius:2px;'>";
$type = 'NULL';
} else {
echo "<div style='width:95%; float:left; position:relative; background-color:#fff; z-index:1000000; margin-bottom:20px; padding:2%;border:1px solid #428f42; color:#428f42; border-radius:2px;'>";
$type = 'STRING / OTHER';
}
}
echo "<span>" . $type . " DUMP - <strong>" . $heading . "</strong></span><br/><br/>";
echo "<span style='dd_v_out full_screen_width'>";
var_dump($argument);
echo "</span>";
echo "</div>";
}
echo "\n\n";
if (!$query_trigger) {
echo "<span style='width:100%;height:10px;float:left;'></span>";
}
}
}
示例10: print_array
function print_array($data)
{
echo '[';
foreach ($data as $row) {
echo '{';
foreach (array_keys($row) as $key) {
if (isset($row[$key])) {
echo $key . ': ';
if (is_array($row[$key]) === FALSE) {
echo '"' . str_replace("\n", "\\n", $row[$key]) . '", ';
} else {
print_array($row[$key]);
echo ',';
}
}
}
echo '},';
}
echo ']';
}
示例11: print_array
function print_array($array, $offset_symbol = "|--", $offset = "", $parent = "")
{
if (!is_array($array)) {
echo "[{$array}] is not an array!<br />";
return;
}
reset($array);
switch ($array['type']) {
case "string":
printf("<li><div align=left class=string> - <span class=icon>[STRING]</span> <span class=title>[%s]</span> <span class=length>(%d)</span>: <span class=value>%s</span></div></li>", $parent, $array['strlen'], $array['value']);
break;
case "integer":
printf("<li><div align=left class=integer> - <span class=icon>[INT]</span> <span class=title>[%s]</span> <span class=length>(%d)</span>: <span class=value>%s</span></div></li>", $parent, $array['strlen'], $array['value']);
break;
case "list":
printf("<li><div align=left class=list> + <span class=icon>[LIST]</span> <span class=title>[%s]</span> <span class=length>(%d)</span></div>", $parent, $array['strlen']);
echo "<ul>";
print_array($array['value'], $offset_symbol, $offset . $offset_symbol);
echo "</ul></li>";
break;
case "dictionary":
printf("<li><div align=left class=dictionary> + <span class=icon>[DICT]</span> <span class=title>[%s]</span> <span class=length>(%d)</span></div>", $parent, $array['strlen']);
while (list($key, $val) = each($array)) {
if (is_array($val)) {
echo "<ul>";
print_array($val, $offset_symbol, $offset . $offset_symbol, $key);
echo "</ul>";
}
}
echo "</li>";
break;
default:
while (list($key, $val) = each($array)) {
if (is_array($val)) {
//echo $offset;
print_array($val, $offset_symbol, $offset, $key);
}
}
break;
}
}
示例12: mail
public function mail()
{
if (count($this->input->post()) > 0) {
$post = $this->input->post();
$post['propio'] = isset($post['propio']) ? $this->unRadio($post['propio']) : 'NO';
$post['franquicia'] = isset($post['franquicia']) ? $this->unRadio($post['franquicia']) : 'NO';
$post['sucursales'] = isset($post['sucursales']) ? $this->unRadio($post['sucursales']) : 'NO';
$post['nombreAgente'] = isset($post['nombreAgente']) ? $post['nombreAgente'] : 'No aplica';
$post['telAgente'] = isset($post['telAgente']) ? $post['telAgente'] : 'No aplica';
$post['emailAgente'] = isset($post['emailAgente']) ? $post['emailAgente'] : 'No aplica';
$data = ['intro' => ucfirst('huayacan58') . ' Email enviado desde: ' . base_url(), 'h1' => ucfirst('huayacan58'), 'p' => 'Email enviado desde: ' . base_url(), 'negocioTitle' => 'Datos del negocio', 'negocioP' => 'Nombre: ' . $post['nombreNegocio'] . '<br>' . 'Giro: ' . $post['giroNegocio'] . '<br>' . 'Interesado en: <br>' . $this->parseLocales($post['locales']) . '<br>' . 'es Propio: ' . $post['propio'] . '<br>' . 'es Franquicia: ' . $post['franquicia'] . '<br>' . 'tiene Sucursales: ' . $post['sucursales'] . '<br>', 'agenteTitle' => 'Datos del Agente', 'agenteP' => 'nombre: ' . $post['nombreAgente'] . '<br>' . 'tel: ' . $post['telAgente'] . '<br>' . 'email: <a target="_blank" href="mailto:' . $post['emailAgente'] . '">' . $post['emailAgente'] . '</a><br>', 'interesadoTitle' => 'Datos del interesado', 'interesadoP' => 'nombre: ' . $post['interesado'] . '<br>' . 'telefono: ' . $post['telefono'] . '<br>' . 'email : <a target="_blank" href="mailto:' . $post['email'] . '">' . $post['email'] . '</a><br>'];
$mensaje = $this->load->view('email/mensaje', $data, TRUE);
if ($this->mailer('info@huayacan58.com', 'Huayacan58.com', $mensaje)) {
redirect(base_url('enviado#contacto'), 'refresh');
} else {
print_array($this->mailer('info@huayacan58.com', 'Huayacan58.com', $mensaje), 1);
// <Ojo no dejar en produccion
}
} else {
redirect(base_url(), 'refresh');
}
}
示例13: array
if ($user_id == 0) {
?>
<input type="text" id="txt_ver1" class="form-control" value="0" aria-describedby="basic-addon4" >
<?php
$_SESSION = array();
} else {
$_SESSION = array();
?>
<input type="text" id="txt_ver1" class="form-control" value="<?php
echo $user_id;
?>
" aria-describedby="basic-addon4" >
<?php
session_start();
$_SESSION["userid"] = $user_id;
print_array($_SESSION);
echo is_login();
}
}
break;
case "profile":
////Login
if (isset($_POST["pass_"]) && isset($_POST["id_"])) {
$user_id = change_pass($_POST["id_"], $_POST["pass_"]);
} else {
if (isset($_POST["oldpass_"]) && isset($_POST["id_"])) {
echo "entro aqui";
$user_id = check_old_pass($_POST["id_"], $_POST["oldpass_"]);
} else {
if (isset($_POST["name_"]) && isset($_POST["last_"]) && isset($_POST["mail_"]) && isset($_POST["id_"])) {
$user_id = change_data($_POST["id_"], $_POST["name_"], $_POST["last_"], $_POST["mail_"]);
示例14: print_sub_header
$data1->prepare($strsql2);
$data1->execute($params);
$data1->commit();
print_sub_header('Inserted two rows and committed. They should exist...');
$data1->prepare($strsql);
$data1->execute(array(&$param1, &$param2));
$data = $data1->data_key_assoc('id');
print_array($data);
print_sub_header('Deleted the two rows that were added then rolled back.');
$strsql3 = 'delete from contacts where id IN (?, ?)';
$data1->prepare($strsql3);
$data1->execute(array(&$param1, &$param2));
$data1->rollback();
//$data1->commit();
print_sub_header('They should still be there...');
$data1->prepare($strsql);
$data1->execute(array(&$param1, &$param2));
$data = $data1->data_key_assoc('id');
print_array($data);
print_sub_header('Deleted the two rows that were added then committed.');
$data1->prepare($strsql3);
$data1->execute(array(&$param1, &$param2));
$data1->commit();
print_sub_header('They should gone.');
$data1->prepare($strsql);
$data1->execute(array(&$param1, &$param2));
$data = $data1->data_key_assoc('id');
print_array($data);
// Stop Benchmark
$cb->stop_timer();
$cb->print_results(true);
示例15: get_all_session_data
function get_all_session_data()
{
$ci =& get_instance();
return print_array($ci->session->all_userdata());
}