本文整理汇总了PHP中dump_array函数的典型用法代码示例。如果您正苦于以下问题:PHP dump_array函数的具体用法?PHP dump_array怎么用?PHP dump_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dump_array函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dump_array
function dump_array($arr, $indent)
{
$i = 0;
foreach ($arr as $key => $value) {
$value_type = gettype($value);
echo "{$indent}" . $i++ . ": ";
#echo "$indent";
echo "Key=" . $key . ", Value=";
if ($value_type == "array") {
echo "<br>";
dump_array($value, $indent . "--> ");
#dump_array_type($value, $indent . "--> ");
} else {
if ($value_type == "object") {
#echo $value_type;
#var_dump($value);
echo "<br>";
dump_array((array) $value, $indent . "--> ");
} else {
echo $value;
echo "<br>";
}
}
}
}
示例2: dump_colours
function dump_colours($cats)
{
global $colours;
$usedcols = array();
foreach ($cats as $c) {
array_push($usedcols, $colours[$c - 1]);
}
dump_array($usedcols, "\$colours ");
}
示例3: dump_array
function dump_array(&$mit, $indent = "")
{
while (list($key, $value) = each($mit)) {
if (gettype($value) == "array") {
echo "<br>" . $indent . "<font face='verdana,helvetica' size=1><b>[{$key}]</b> =";
echo " ARRAY<br>\n" . $indent . " [</font><br>\n";
dump_array($value, $indent . " ");
echo $indent . " ]<br>\n";
} else {
echo $indent . "<font face='verdana,helvetica' size=1><b>[{$key}]</b> =";
echo " [" . htmlspecialchars($value) . "]</font><br>\n";
}
}
}
示例4: dump_arbitrary
/**
* Works in conjunction with the debug function to pretty-print a variable of arbitrary type.
*
* @return string
* @param mixed $var A reference to the variable to pretty-print
* @param bool $b_verbose A boolean that indicates whether to print verbose output.
* @param int $i_indent The current intendation level.
*/
function dump_arbitrary(&$var, $b_verbose = false, $i_indent = 0, $str_unique_id = '')
{
// if the var is an array, recurse...
if (is_array($var)) {
dump_array($var, $b_verbose, $i_indent);
} else {
if (is_object($var)) {
dump_object($var, $b_verbose, $i_indent);
} else {
dump_scalar($var, $b_verbose, $str_unique_id);
}
}
}
示例5: read
function read($resource, $len = null)
{
global $udp_host_map;
# Max packet length is magic. If we're reading a pipe that has data but
# isn't going to generate any more without some input, then reading less
# than all bytes in the buffer or 8192 bytes, the next read will never
# return.
if (is_null($len)) {
$len = 8192;
}
#my_print(sprintf("Reading from $resource which is a %s", get_rtype($resource)));
$buff = '';
switch (get_rtype($resource)) {
case 'socket':
if (array_key_exists((int) $resource, $udp_host_map)) {
my_print("Reading UDP socket");
list($host, $port) = $udp_host_map[(int) $resource];
socket_recvfrom($resource, $buff, $len, PHP_BINARY_READ, $host, $port);
} else {
my_print("Reading TCP socket");
$buff .= socket_read($resource, $len, PHP_BINARY_READ);
}
break;
case 'stream':
global $msgsock;
# Calling select here should ensure that we never try to read from a socket
# or pipe that doesn't currently have data. If that ever happens, the
# whole php process will block waiting for data that may never come.
# Unfortunately, selecting on pipes created with proc_open on Windows
# always returns immediately. Basically, shell interaction in Windows
# is hosed until this gets figured out. See https://dev.metasploit.com/redmine/issues/2232
$r = array($resource);
my_print("Calling select to see if there's data on {$resource}");
while (true) {
$cnt = stream_select($r, $w = NULL, $e = NULL, 0);
# Stream is not ready to read, have to live with what we've gotten
# so far
if ($cnt === 0) {
break;
}
# if stream_select returned false, something is wrong with the
# socket or the syscall was interrupted or something.
if ($cnt === false or feof($resource)) {
my_print("Checking for failed read...");
if (empty($buff)) {
my_print("---- EOF ON {$resource} ----");
$buff = false;
}
break;
}
$md = stream_get_meta_data($resource);
dump_array($md);
if ($md['unread_bytes'] > 0) {
$buff .= fread($resource, $md['unread_bytes']);
break;
} else {
#$len = 1;
$tmp = fread($resource, $len);
$buff .= $tmp;
if (strlen($tmp) < $len) {
break;
}
}
if ($resource != $msgsock) {
my_print("buff: '{$buff}'");
}
$r = array($resource);
}
my_print(sprintf("Done with the big read loop on {$resource}, got %d bytes", strlen($buff)));
break;
default:
# then this is possibly a closed channel resource, see if we have any
# data from previous reads
$cid = get_channel_id_from_resource($resource);
$c = get_channel_by_id($cid);
if ($c and $c['data']) {
$buff = substr($c['data'], 0, $len);
$c['data'] = substr($c['data'], $len);
my_print("Aha! got some leftovers");
} else {
my_print("Wtf don't know how to read from resource {$resource}, c: {$c}");
if (is_array($c)) {
dump_array($c);
}
break;
}
}
my_print(sprintf("Read %d bytes", strlen($buff)));
return $buff;
}
示例6: getTime
require_once 'includes/content/start.php';
}
}
// Debug informations
if ($config['debug']) {
$endTime = getTime();
$totalTime = $endTime - $startTime;
$debug['pageGenerated'] = 'Page was generated in ' . $totalTime . ' seconds';
if (function_exists('memory_get_usage')) {
$debug['memoryUsage'] = 'Memory usage : ' . round(memory_get_usage() / 1024) . ' KB';
} else {
$debug['memoryUsage'] = '';
}
$debug['numberQueries'] = 'Page used ' . $con->getNumQueries() . ' queries';
$debug['queriesData'] = '<div id="queriesList">';
foreach ($con->getQueriesDebug() as $queryData) {
$debug['queriesData'] .= $queryData . '<br />';
}
$debug['queriesData'] .= '</div>';
function dump_array($array)
{
return print_r($array, true);
}
$debug['dumpVars'] = '<div id="dumpVars">Variables dump<br />GET Vars<br />' . dump_array($_GET) . '<br /><br />POST Vars<br />
' . dump_array($_POST) . '<br /><br />SESSION Vars<br />
' . dump_array($_SESSION) . '<br /><br />COOKIE Vars<br />' . dump_array($_COOKIE) . '</div>';
echo '<link rel="stylesheet" href="../includes/commonStyle.css" type="text/css" />';
echo '<div id="debug">DEBUG<br />' . $debug['pageGenerated'] . '<br />' . $debug['memoryUsage'] . '<br />' . $debug['numberQueries'] . '<br />' . $debug['queriesData'] . '<hr />' . $debug['dumpVars'] . '</div>';
}
echo '</div>';
echo "</body></html>";
示例7: lang
<FORM action="subpool_delete.php">
<INPUT type=hidden name="subpool_id" value="' . $subpool_id . '">
<TABLE class="or_formtable">
<TR><TD colspan="2">
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
' . lang('delete_subpool') . ' "' . $subpool['subpool_name'] . '"
</TD>
</TR></TABLE>
</TD></TR>
<TR>
<TD colspan=2>
' . lang('really_delete_subpool?') . '
<BR><BR>';
dump_array($subpool);
echo '</TD></TR>
<TR><TD align=left colspan=2>
<INPUT class="button" type=submit name=reallydelete value="' . lang('yes_delete') . '">
<BR>' . lang('merge_subject_pool_with') . ' ';
echo subpools__select_field("merge_with", "1", array($subpool_id));
echo ' </TD></TR><TR>
<TD align=center colspan=2><BR><BR>
<INPUT class="button" type=submit name=betternot value="' . lang('no_sorry') . '">
</TD>
</TR>
</TABLE>
</FORM>
</center>';
}
include "footer.php";
示例8: lang
// form
echo '<center>';
echo '
<TABLE class="or_formtable">
<TR><TD colspan="2">
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
' . lang('delete_symbol') . ' ' . $symbol['content_name'] . '
</TD>
</TR></TABLE>
</TD></TR>
<TR>
<TD colspan=2>
' . lang('do_you_really_want_to_delete') . '
<BR><BR>';
dump_array($symbol);
echo '
</TD>
</TR>
<TR>
<TD align=left>
' . button_link('lang_symbol_delete.php?lang_id=' . urlencode($lang_id) . '&reallydelete=true', lang('yes_delete'), 'check-square biconred') . '
</TD>
<TD align=right>
' . button_link('lang_symbol_delete.php?lang_id=' . urlencode($lang_id) . '&betternot=true', lang('no_sorry'), 'undo bicongreen') . '
</TD>
</TR>
</TABLE>
</center>';
}
include "footer.php";
示例9: lang
if ($proceed) {
// form
echo ' <CENTER>
<TABLE class="or_formtable">
<TR><TD colspan="2">
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '">
' . lang('delete_session') . ' ' . session__build_name($session) . '
</TD>
</TR></TABLE>
</TD></TR>
<TR>
<TD colspan=2>
' . lang('really_delete_session') . '
<BR><BR>';
dump_array($session);
echo '
</TD>
</TR>
<TR>
<TD align=left>
' . button_link('session_delete.php?session_id=' . $session_id . '&reallydelete=true', lang('yes_delete'), 'check-square biconred') . '
</TD>
<TD align=right>
' . button_link('session_delete.php?session_id=' . $session_id . '&betternot=true', lang('no_sorry'), 'undo bicongreen') . '
</TD>
</TR>
</TABLE>
</center>';
}
include "footer.php";
示例10: dump_array
<?php
// these lines format the output as HTML comments
// and call dump_array repeatedly
echo '\\n<!-- BEGIN VARIABLE DUMP -->\\n\\n';
echo '<!-- BEGIN GET VARS -->\\n';
echo '<!-- ' . dump_array($HTTP_GET_VARS) . ' -->\\n';
echo '<!-- BEGIN POST VARS -->\\n';
echo '<!-- ' . dump_array($HTTP_POST_VARS) . ' -->\\n';
echo '<!-- BEGIN SESSION VARS -->\\n';
echo '<!-- ' . dump_array($HTTP_SESSION_VARS) . ' -->\\n';
echo '<!-- BEGIN COOKIE VARS -->\\n';
echo '<!-- ' . dump_array($HTTP_COOKIE_VARS) . ' -->\\n';
echo '\\n<!-- END VARIABLE DUMP -->\\n';
// dump_array() takes one array as a parameter
// It iterates through that array, creating a string
// to represent the array as a set
function dump_array($array)
{
if (is_array($array)) {
$size = count($array);
$string = '';
if ($size) {
$count = 0;
$string .= '{ ';
// add each element's key and value to the string
foreach ($array as $var => $value) {
$string .= "{$var} = {$value}";
if ($count++ < $size - 1) {
$string .= ', ';
}
示例11: lang
// form
echo ' <CENTER>
<FORM action="options_participant_profile_delete.php">
<INPUT type="hidden" name="mysql_column_name" value="' . $field_name . '">
<TABLE class="or_formtable">
<TR><TD colspan="2">
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
' . lang('delete_participant_profile_field') . ' "' . $field_name . '"
</TD>
</TR></TABLE>
</TD></TR>
<TR>
<TD colspan=2>' . lang('really_delete_profile_form_field?') . '<BR><BR>
<B>' . lang('delete_profile_form_field_note') . '</B><BR><BR>';
dump_array($field);
echo ' </TD>
</TR>
<TR>
<TD align=center>
' . button_link('options_participant_profile_delete.php?mysql_column_name=' . urlencode($field_name) . '&reallydelete=true', lang('yes_delete'), 'check-square biconred') . '
</TD>
</TR>
<TR>
<TD align="right" colspan=2><BR><BR>
' . button_link('options_participant_profile_edit.php?mysql_column_name=' . urlencode($field_name), lang('no_sorry'), 'undo bicongreen') . '
</TD>
</TR>
</TABLE>
</FORM>
示例12: lang
<FORM action="experiment_type_delete.php">
<INPUT type=hidden name="exptype_id" value="' . $exptype_id . '">
<TABLE class="or_formtable">
<TR><TD colspan="2">
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
' . lang('delete_experiment_type') . ' "' . $exptype['exptype_name'] . '"
</TD>
</TR></TABLE>
</TD></TR>
<TR>
<TD colspan="2" align="center">
' . lang('do_you_really_want_to_delete') . '
<BR><BR>';
dump_array($exptype);
echo '
</TD>
</TR>
<TR>
<TD align=left width="50%">
' . lang('replace_experimenttype_with') . ' ';
experiment__exptype_select_field("merge_with", "exptype_id", "exptype_name", "", $exptype['exptype_id']);
echo '<BR><BR>
<INPUT class="button" type="submit" name="reallydelete" value="' . lang('yes_delete') . '">';
echo ' </TD>
</TD>
<TD align=right>
<INPUT class="button" type="submit" name="betternot" value="' . lang('no_sorry') . '">
</TD>
</TR>
示例13: lang
if ($proceed) {
// form
echo '<center>
<TABLE class="or_formtable">
<TR><TD colspan="2">
<TABLE width="100%" border=0 class="or_panel_title"><TR>
<TD style="background: ' . $color['panel_title_background'] . '; color: ' . $color['panel_title_textcolor'] . '" align="center">
' . lang('delete_experiment') . ' ' . $experiment['experiment_name'] . '
</TD>
</TR></TABLE>
</TD></TR>
<TR>
<TD colspan=2>
' . lang('really_delete_experiment') . '
<BR><BR>';
dump_array($experiment);
echo '
</TD>
</TR>
<TR>
<TD align=left>
' . button_link('experiment_delete.php?experiment_id=' . $experiment_id . '&reallydelete=true', lang('yes_delete'), 'check-square biconred') . '
</TD>
<TD align=right>
' . button_link('experiment_delete.php?experiment_id=' . $experiment_id . '&betternot=true', lang('no_sorry'), 'undo bicongreen') . '
</TD>
</TR>
</TABLE>
</center>';
}
include "footer.php";
示例14: event_logoutput
/**
* Function to write some information into a logfile
*/
function event_logoutput($event_name, $eventdata)
{
global $CFG;
if ($LOGG = fopen($CFG->dirroot . '/mod/mumiemodule/logs/event_log.txt', 'a')) {
fputs($LOGG, date("F d Y h:i:s A") . ": ");
fputs($LOGG, $event_name);
fputs($LOGG, dump_array($eventdata));
fputs($LOGG, "\n \n");
}
}
示例15: dumpArray
/**
* Dump array into a file. Similar to *var_dump* but the result
* is not human readable (reduces space by a third in large arrays)
*/
public static function dumpArray($path, array $data, $perm = 0644)
{
self::write($path, "<?php return " . dump_array($data) . ';', $perm);
}