When we use arrays, we often encounter that the array does not exist, causing a Notice: Undefined offset error when we store array[100]. Let me introduce to you how to solve this problem
Example:
The code is as follows
代码如下 |
复制代码 |
$array[1] ='www.bKjia.c0m';
echo $array[0] ;
|
|
Copy code
|
$array[1] ='www.bKjia.c0m';
echo $array[0] ;
代码如下 |
复制代码 |
echo isset($array[0])?$array[0]:'数组未定义';
|
| The input result is
Notice: Undefined offset: 1 in D:wwwrootwraskseo404.php on line 5 Let’s look at the solution
Solving this problem is as simple as
The code is as follows
|
Copy code
echo isset($array[0])?$array[0]:'Array is undefined';
This solves this problem very well.
http://www.bkjia.com/PHPjc/632118.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632118.htmlTechArticleWhen we use arrays, we often encounter that the array does not exist, causing us to store array[100]. Notice: Undefined offset error, let me introduce how to solve this problem...
|
|
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