Home >Backend Development >PHP Tutorial >A tragedy for php arrays? _PHP Tutorial

A tragedy for php arrays? _PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:29:52897browse

Copy code The code is as follows:

$a=1;
$b=2;
$t = array(
array('a', 'string', $field['a']), // Name
if($a==$b){array('b','1')}
);
print_r($t);
exit;

1. Because the array is long. Didn't notice
2. The development code did not clear the cache in time. . . . The tragedy begins here
The following is the correct usage
$a==$b?array('sDesc','1'):array('sDesc','2')
Copy code The code is as follows:

$a=1;
$b=2;
$t = array(
array('a', 'string', $field['a']), // name
$a==$b?array('b','1'):array('b',' 2')
);
print_r($t);
exit;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323351.htmlTechArticleCopy the code The code is as follows: $a=1; $b=2; $t = array( array('a ', 'string', $field['a']), // name if($a==$b){array('b','1')} ); print_r($t); exit; 1 , due to the long length of the array. No note...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn