"a@b.z"); 我可以通过 访问电子邮件 $arr['c_m_email'] 但是还有另一种方法可以只写 $-6ren">
gpt4 book ai didi

php - 通过索引访问 PHP 字符串数组

转载 作者:行者123 更新时间:2023-12-04 03:05:39 24 4
gpt4 key购买 nike

我有一个像这样的 PHP 数组

$arr = array("c_m_email" => "a@b.z");

我可以通过

访问电子邮件
$arr['c_m_email'] 

但是还有另一种方法可以只写 $arr[0] 吗?

最佳答案

使用array_values()

array_values() returns all the values from the array and indexes the array numerically.

手册:http://php.net/manual/en/function.array-values.php

关于php - 通过索引访问 PHP 字符串数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44802544/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com