Home >Backend Development >PHP Tutorial >What is the subscript of $tg['x']='b';?

What is the subscript of $tg['x']='b';?

WBOY
WBOYOriginal
2016-07-06 13:53:11809browse

$tg[]='q';
$tg['x']='b';
$tg[]='g';
? >

What is the subscript of $tg['x']='b';? Can it only be ‘x’? How is it arranged in the array?

Reply content:

$tg[]='q';
$tg['x']='b';
$tg[]='g';
? >

What is the subscript of $tg['x']='b';? Can it only be ‘x’? How is it arranged in the array?

<code class="shell">php > $tg[]='q';
php > $tg['x']='b';
php > $tg[]='g';
php > print_r($tg);
Array
(
    [0] => q
    [x] => b
    [1] => g
)</code>

The subscript is x, the second digit of the array

Didn’t you specify the subscript?

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