The php array is converted into something like this

WBOY
Release: 2016-10-12 10:04:10
Original
1065 people have browsed it

An array like thisArray ( [0] => a [1] => s [2] => d [3] => f ) is converted into Array ( '0' => ' a','1' => 's', '2' => 'd', '3' => 'f' ) Is it possible? Please give me guidance

In fact, the process is as follows: two strings $atr = 1,2,3,4 $str=a,b,c,f are converted into array array in one-to-one correspondence ('1'=>'a','2' =>'b','3'=>'c','4'=>'f')

And print out array('1'=>'a','2'=>'b','3'=>'c','4'=>'f'), don't know this Is it easy to understand?

Reply content:

An array like this

Array ( [0] => a [1] => s [2] => d [3] => f ) is converted into Array ( '0' => ' a','1' => 's', '2' => 'd', '3' => 'f' ) Is it possible? Please give me guidance

In fact, the process is as follows: two strings $atr = 1,2,3,4 $str=a,b,c,f are converted into array array in one-to-one correspondence ('1'=>'a','2' =>'b','3'=>'c','4'=>'f')

And print out array('1'=>'a','2'=>'b','3'=>'c','4'=>'f'), don't know this Is it easy to understand?

The php array is converted into something like thisThis of yours cannot be used

It should not work

If the key of the array can be converted into Int, it will be converted into a number

You can refer to the manual
http://php.net/manual/zh/lang...

<code>Array ( [0] => a [1] => s [2] => d [3] => f )

</code>
Copy after login
When such an array display appears, it is generally a friendly display of dump under tp. It's not an array.

<code>$tmp = array( '0' => 'a','1' => 's', '2' => 'd', '3' => 'f' );
var_dump($tmp);
</code>
Copy after login

The above code shows:

<code>Array ( [0] => a [1] => s [2] => d [3] => f )
</code>
Copy after login

====================dump source code============================

<code> /**
 * 浏览器友好的变量输出
 * @param mixed $var 变量
 * @param boolean $echo 是否输出 默认为true 如果为false 则返回输出字符串
 * @param string $label 标签 默认为空
 * @return void|string
 */
public static function dump($var, $echo = true, $label = null)
{
    $label = (null === $label) ? '' : rtrim($label) . ':';
    ob_start();
    var_dump($var);
    $output = ob_get_clean();
    $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);
    if (IS_CLI) {
        $output = PHP_EOL . $label . $output . PHP_EOL;
    } else {
        if (!extension_loaded('xdebug')) {
            $output = htmlspecialchars($output, ENT_QUOTES);
        }
        $output = '<pre class="brush:php;toolbar:false">' . $label . $output . '
'; } if ($echo) { echo ($output); return null; } else { return $output; } }
Copy after login

How did you arrive at this array? ? ! !

Array ( [0] => a [1] => s [2] => d [3] => f )


Are there commas between parameters?

For example, Array ( [0] => a ,[1] => s, [2] => d ,[3] => f );

But this is also an empty array?

The php array is converted into something like this

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!