为了账号安全,请及时绑定邮箱和手机立即绑定

在PHP中这些数组怎么用?

在PHP中这些数组怎么用?

PHP
森栏 2019-03-10 01:18:25
问题很简单,就是数组怎么用?问题好像有点开放,就是怎么利用name来使用这些数组,或者有没有更好的方法或者相关文章介绍。附上我的神代码,小白在此谢过大神指点。抱拳抱拳再抱拳。 <?php $shuzu[] = array( "name" => "数字", "slug" => "1", "desc" => "2", "id" => "3", "type" => "4" ); $shuzu[] = array( "name" => "字母", "slug" => "a", "desc" => "b", "id" => "c", "type" => "d" ); $shuzu[] = array( "name" => "组合", "slug" => "q5", "desc" => "w6", "id" => "e7", "type" => "r8" ); ?>
查看完整描述

5 回答

?
至尊宝的传说

TA贡献1789条经验 获得超10个赞

<?php

$Arr = [
    '数字' => [
        "slug" => "1",
        "desc" => "2",
        "id"   => "3",
        "type" => "4"
    ],
    '字母' => [
        "slug" => "a",
        "desc" => "b",
        "id"   => "c",
        "type" => "d"
    ],
    '组合' => [
        "slug" => "q5",
        "desc" => "w6",
        "id"   => "e7",
        "type" => "r8"
    ],
];

echo '<pre>';
var_dump($Arr['数字'], $Arr['字母'], $Arr['组合']);

楼上+1;同附链接PHP多维数组
修改了下,不知道楼主是否要实现这种?
根据Key去读对应的Value,数组的元素也可以是数组。

查看完整回答
反对 回复 2019-03-18
?
江户川乱折腾

TA贡献1851条经验 获得超5个赞

$shuzukey

查看完整回答
反对 回复 2019-03-18
  • 5 回答
  • 0 关注
  • 375 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信