phpcheck.table.class.html.php Total: 22 Tests, 0 Errors, ↻all
PHPCheck V1.66, OS: Linux, Machine: el8_9.x86_64, PHP-Version: 8.2.18 (64 Bit), Time: 1.513 ms (AVG: 0.069 ms), Memory: 2.0M (512M)
CommentLineCodeResultTest
exist versions info 21 $info $t->getClassVersion('html');
$t->check($info, !empty($info)); 
[0.307 ms]
1.9.22
Ok
1 dim num. Array 25 $data = array("e0","e1","e2");
$html html::Table('border=1',HTML::NOTITLE,$data);
$t->checkHTML($html,'0,e0,1,e1,2,e2');  //right order 
[0.066 ms]
0e0
1e1
2e2
Ok
1 dim ass. Array with title 30 $data = array('sp1.1' => 'sp1.2''sp2.1' => 'sp2.2');
$title = array('Spalte 1','Spalte 2');
$html html::Table('border=1',$title,$data);
$t->checkHTML($html,$title); 
[0.062 ms]
Spalte 1 Spalte 2
sp1.1sp1.2
sp2.1sp2.2
Ok
2 dim num. Array with title 36 $data = array(
  array(
11,12,13),
  array(
21,22,23),
);
$title = array('Spalte 1','Spalte 2','Spalte 3');
$html html::Table('border=2',$title,$data);
$t->checkHTML($html,$title); 
[0.025 ms]
Spalte 1 Spalte 2 Spalte 3
11 12 13
21 22 23
Ok
2 dim num. Array with title = first Line data 45 $data = array(
  array(
'Spalte 1','Spalte 2','Spalte 3'),
  array(
11,12,13),
  array(
21,22,23),
);
$title array_shift($data);
$html html::Table('border=2',$title,$data);
$t->checkHTML($html,$title); 
[0.026 ms]
Spalte 1 Spalte 2 Spalte 3
11 12 13
21 22 23
Ok
2 dim num. Array without title, inlinestyle 55 $data = array(
  array(
11,12,13),
  array(
21,22,23),
);
$style 'style="background-color:#3a3;"';
$html $result html::Table($style ,HTML::NOTITLE,$data);
$t->checkHTML($html,'11,12'); 
[0.017 ms]
11 12 13
21 22 23
Ok
2 dim num. Array with CSS 64 $css1 '.mytab { border: #5F5F5F 1px solid; border-collapse:collapse;}
.mytab th, .mytab td {border: #5F5F5F 1px solid; padding:4px;}
'
;
$t->addCss($css1); //add new style
$data = array(
  array(
11,12,13),
  array(
21,22,23),
);
$html html::Table('class="mytab"',HTML::NOTITLE,$data);
$t->checkHTML($html,'11,12'); 
[0.021 ms]
11 12 13
21 22 23
Ok
2 dim num. Array with title + CSS 76 $css2 '.mytab2 th{
  background-color: #338;
  color: white;  
}'
;
$t->addCss($css2); //add new style
$data = array(
  array(
11,12,13),
  array(
21,22,23),
);
$title = array('Col 1','Col 2','Col 3');
$html html::Table('border=1 class="mytab2"',$title,$data);
$t->checkHTML($html,'11,12'); 
[0.022 ms]
Col 1 Col 2 Col 3
11 12 13
21 22 23
Ok
2 dim num. Array with title + CSS for cols 90 $css3 '.mytab3 .Col_0{background-color: #f88;}
  .mytab3 .Col_1{background-color: #8f8;}
  .mytab3 .Col_2{background-color: #88f;}
'
;
$t->addCss($css3); //add new style
$data = array(
  array(
11,12,13),
  array(
21,22,23),
);
$title = array('Col 1','Col 2','Col 3');
$html html::Table('border=1 class="mytab3"',$title,$data);
$t->checkHTML($html,'11,12'); 
[0.023 ms]
Col 1 Col 2 Col 3
11 12 13
21 22 23
Ok
2 dim num. Array with title + CSS alternate lines 104 $css4 'table.mytab4 {border:1px solid gray;}
.mytab4 th{background-color: #338; color: white;}
.mytab4 tr:nth-child(odd)  { background-color:inherit; }
.mytab4 tr:nth-child(even) { background-color:#DDD; }
'
;
$t->addCss($css4); //add new style
$data = array(
  array(
11,12,13),
  array(
21,22,23),
  array(
31,32,33),
  array(
41,42,43),
);
$title = array('Col 1','Col 2','Col 3');
$html html::Table('class="mytab4"',$title,$data);
$t->checkHTML($html,'11,12'); 
[0.031 ms]
Col 1 Col 2 Col 3
11 12 13
21 22 23
31 32 33
41 42 43
Ok
2 dim ass. Array with title from keys 121 $data = array(
  
"row1" => array('a' => 11,'b' => 12'c' => 13),
  
"row2" => array('a' => 21,'b' => 22'c' => 23),
);
$html html::Table('border=1',HTML::KEYTITLE,$data);
$t->checkHTML($html,'11,12'); 
[0.026 ms]
a b c
11 12 13
21 22 23
Ok
2 dim ass. Array with objects 129 $data = array(
  (object) array(
'col1' => 11,'col2' => '12 €''col3' => 'ÄÖÜ'),
  (object) array(
'col1' => 21,'col2' => '22 €''col3' => "ß"),
);
$html html::Table('border=1',HTML::KEYTITLE,$data);
$t->checkHTML($html,'11,12'); 
[0.032 ms]
col1 col2 col3
11 12 € ÄÖÜ
21 22 € ß
Ok
objects with objects 137 $data = (object)array(
  (object) array(
'col1' => 11,'col2' => '12 €''col3' => 'ÄÖÜ'),
  (object) array(
'col1' => 21,'col2' => '22 €''col3' => "ß"),
);
$html html::Table('border=1',HTML::KEYTITLE,$data);
$t->checkHTML($html,'11,12'); 
[0.031 ms]
col1 col2 col3
11 12 € ÄÖÜ
21 22 € ß
Ok
2 dim ass. Array with keys as 1.col 145 $data = array(
  
"row1" => array('a' => 11,'b' => 12'c' => 13),
  
"row2" => array('a' => 21,'b' => 22'c' => 23),
);
$html html::Table('border=1',HTML::NOTITLE,$data,HTML::KEYCOL);
$t->checkHTML($html,'row1,11,12,row2,21,23');  //right order 
[0.024 ms]
row1 11 12 13
row2 21 22 23
Ok
2 dim ass. Array, select cols with keys from title 153 $data = array(
  
"row1" => array('a' => 11,'b' => 12'c' => 13),
  
"row2" => array('a' => 21,'b' => 22'c' => 23),
);
$title = array('a' => 'Col a''c' => 'Col c');  //Select a + c
$html html::Table('border=1',$title,$data,HTML::KEYSEL);
$t->checkHTML($html,'Col a,Col c,11,13,21,23');  //right order 
[0.021 ms]
Col a Col c
11 13
21 23
Ok
title from 2.row , select cols user defined 162 $data = array(
  array(
'Header'), 
  array(
'Spalte 1','Spalte 2','Spalte 3'), 
  array(
11,12,13), 
  array(
21,22,23), 
); 
$header array_shift($data);  //remove header
$title array_shift($data);
$title = array("0" =>$title[0],"2"=>$title[2]);

$html html::Table('border=2',$title,$data,HTML::KEYSEL);
$t->checkHTML($html,'Spalte 1,Spalte 3,11,13,21,23');  //right order 
[0.018 ms]
Spalte 1 Spalte 3
11 13
21 23
Ok
2 dim num. Array with (escaped) html 176 $data = array(
  array(
11,12),
  array(
21,'html<br>html'),
);
$html html::Table('border=1',html::NOTITLE,$data);
$t->checkHTML($html,'11,12,html&lt;br&gt;html'); 
[0.016 ms]
11 12
21 html<br>html
Ok
2 dim num. Array with (non escaped) html 184 $data = array(
  array(
11,12),
  array(
21,'html<br>html'),
);
$html html::Table('border=1',html::NOTITLE,$datahtml::HTML);
$t->checkHTML($html,'11,12,html<br>html'); 
[0.036 ms]
11 12
21 html
html
Ok
1 dim Array with title + format 192 $data = array('1.2''2.2');
$opt = array(
  
'title' => array('Index','Value'),
  
'format' => array('%04d''%4.2f m')
);
$html html::Table('border=1',$opt,$data);
$t->checkHTML($html,'Index,Value'); 
[0.551 ms]
Index Value
00001.20 m
00012.20 m
Ok
1 dim ass. Array with title + format 201 $data = array('sp1.1' => '1.2''sp2.1' => '2.2');
$opt = array(
  
'title' => array('Spalte 1','Spalte 2'),
  
'format' => array('%8s''%4.2f m')
);
$html html::Table('border=1',$opt,$data);
$t->checkHTML($html,'Spalte 1,Spalte 2'); 
[0.025 ms]
Spalte 1 Spalte 2
sp1.11.20 m
sp2.12.20 m
Ok
2 dim Array with title + format 210 $data = array( 
  array(
11,1.2,'2019-03-14'), 
  array(
21,2.2,'2019-03-16'), 
);
$title = array(
  
'title' => array('Spalte 1','Spalte 2','Spalte 3'),
  
'format' => array('%03d','%5.2f','d.m.Y')
); 
$html html::Table('border=2',$title,$data); 
$t->checkHTML($html,'Spalte 1,Spalte 2,14.03.2019'); 
[0.108 ms]
Spalte 1 Spalte 2 Spalte 3
011 1.20 14.03.2019
021 2.20 16.03.2019
Ok
2 dim Array with select, title + format 222 $data = array( 
  
"row1" => array('a' => 11,'b' => 12'c' => 13), 
  
"row2" => array('a' => 21,'b' => 22'c' => 23), 
); 
$title = array(
  
'title' => array('c' => 'Col c''a' => 'Col a'), //Select c + a
  
'format' => array('c' => '%03d''b' => '%04d''a' => '%05d')
); 
$html html::Table('border=1',$title,$data,HTML::KEYSEL);
$t->checkHTML($html,'Col c,Col a'); 
[0.025 ms]
Col c Col a
013 00011
023 00021
Ok