return '['.PHP_EOL;
}
- function rows_rec_json($row) {
+ function rows_rec_json(&$row) {
$json = '';
if ($this->_row_json === null) {
$this->_row_json = true;
return "---\n";
}
- function rows_rec_yaml($row) {
+ function rows_rec_yaml(&$row) {
$yaml = yaml_emit($row);
$yaml = preg_replace('/^---\n/','',$yaml);
$yaml = preg_replace('/\n\.\.\.$/','',$yaml);
;
}
- function rows_rec_xml($row) {
+ function rows_rec_xml(&$row) {
$xml = '';
$xml .= "\t<rows>".PHP_EOL;
- foreach (array_keys($this->fields()) as $f) {
- if ($row[$f] !== '') $xml .= ''
- . "\t\t<".$f.'>'
- .'<![CDATA['.$row[$f].']]>'
- . '</'.$f.'>'
+ foreach ($row as $k=>$v) {
+ if ($v !== '') $xml .= ''
+ . "\t\t<".$k.">"
+ .'<![CDATA['.$v.']]>'
+ . '</'.$k.'>'
.PHP_EOL;
}
$xml .= "\t</rows>".PHP_EOL;
return join("\t",array_keys($fields))."\n";
}
- function rows_rec_csv($row) {
+ function rows_rec_csv(&$row) {
return join("\t",array_values($row))."\n";
}
function rows_begin_table() {
$html = '';
- $html .= '<table class="rows db '.$this->name.'">'.PHP_EOL;
+ $html .= '<table class="rows '.$this->name.'">'.PHP_EOL;
$colspan = 0;
if (DB_HTML_EDIT) $colspan++;
$html .= '<tr class="head">';
- if (DB_HTML_EDIT) $html .= '<th class="'.DB_HTML_EDIT.'"></th>';
+ if (DB_HTML_EDIT) $html .= '<th class="edit"></th>';
foreach (array_keys($this->fields()) as $f) {
$html .= '<th class="'.$f.'">'.$this->url_sort($f).'</th>';
}
- if (DB_HTML_DELETE) $html .= '<th class="'.DB_HTML_DELETE.'"></th>';
+ if (DB_HTML_DELETE) $html .= '<th class="delete"></th>';
$html .= '</tr>'.PHP_EOL;#.'<tbody>'.PHP_EOL;
return $html;
}
- function rows_rec_table($row) {
-
- array_unshift($row,'<a class="edit button" href="'.$this->url_keys($row,'action=edit').'">'.DB_HTML_EDIT.'</a>');
- array_push($row,'<a class="delete button" href="'.$this->url_keys($row,'action=delete').'">'.DB_HTML_DELETE.'</a>');
+ function rows_rec_table(&$row) {
$html = '<tr class="row">';
+ $html .= '<td class="action"><a class="edit button" href="'.$this->url_keys($row,'action=edit').'">'.DB_HTML_EDIT.'</a></td>';
+
foreach ($row as $k => $v) {
$html .= '<td class="'.$k.'">'.$v.'</td>';
}
+ $html .= '<td class="action"><a class="delete button" href="'.$this->url_keys($row,'action=delete').'">'.DB_HTML_DELETE.'</a></td>';
$html .= '</tr>'.PHP_EOL;
return $html;
if (!empty($opt['count'])) $html .= ''#'<tfoot>'.PHP_EOL
.'<tr class="nav bottom">'
. '<td colspan="'.(
- count($this->fields())
- +(DB_HTML_EDIT ? 1 :0)
- +(DB_HTML_DELETE ? 1 :0)
+ count($this->fields()) +(DB_HTML_EDIT ? 1 :0) +(DB_HTML_DELETE ? 1 :0)
).'">'
. $this->nav($opt['count'],$opt['tot'],$opt['limit'])
. '</td>'
Html Div
-----------------------------------------------------------------*/
function rows_begin_div() {
- return '<div class="rows db '.$this->name.'">'.DB_HTML_NAV_TOP.PHP_EOL;
+ return '<div class="rows '.$this->name.'">'.DB_HTML_NAV_TOP.PHP_EOL;
}
- function rows_rec_div($row) {
+ function rows_rec_div(&$row) {
$html = '';
+#!/usr/bin/env php -q
<?php // test.php
if (0) die(
' strpos: '.strpos('text/html', 'ml')
exit;
*/
-function _static() {
- static $v = null;
- if ($v === null) $v = preg_match('/zaza/','zaza hello') ? true : false;
- return $v;
-} benchmark('_static');
-
-function _glob() {
- if (!isset($GLOBALS['ZAZA'])) $GLOBALS['ZAZA'] = preg_match('/zaza/','zaza hello') ? true : false;
- return $GLOBALS['ZAZA'];
-} benchmark('_glob');
-
-function _defined() {
- if (!defined('ZAZA')) define('ZAZA',preg_match('/zaza/','zaza hello') ? true : false);
- return ZAZA;
-} benchmark('_defined');
-
-function direct() {
- return preg_match('/zaza/','zaza hello');
-} benchmark('direct');
-benchmark();
-exit;
-
+function __f1(&$ar) { $v=$ar; return; foreach ($ar as $v) { 1; } }
+function __f2($ar) { return; foreach ($ar as $v) { 1; } }
+$array = array_fill(0,10000,"a");
function _f1() {
- $_REQUEST['zaza'] === null;
+ __f1($array);
} benchmark('_f1');
function _f2() {
- $_REQUEST['zaza'] == null;
+ __f2($array);
} benchmark('_f2');
+benchmark(); exit;
+
function _f3() {
@$_REQUEST['zaza'];
} benchmark('_f3');
!empty($_REQUEST['zaza']);
} benchmark('_f5');
-benchmark();
-exit;
+benchmark(); exit;
$g = array();
function _is_set() {