Php 向单个数组位置添加2个变量

Php 向单个数组位置添加2个变量,php,Php,我试图添加两个变量,这两个变量恰好都是一个数组的复选框,该数组是名为SPIP的后端的一部分 单个复选框的当前阵列设置如下所示: $UpcomingEvent = 'is_upcoming_event'; $ThermometerEvent = 'is_thermometer_event'; $GLOBALS['champs_extra'] = array ( 'articles' => array ( $nis => "checkbox|propre|New

我试图添加两个变量,这两个变量恰好都是一个数组的复选框,该数组是名为SPIP的后端的一部分

单个复选框的当前阵列设置如下所示:

$UpcomingEvent = 'is_upcoming_event';
$ThermometerEvent = 'is_thermometer_event';
$GLOBALS['champs_extra'] = array (
    'articles' => array (
        $nis => "checkbox|propre|New Inspirational Stories?",
        $UpcomingEvent => "checkbox|propre|Is a Upcoming Event? (<em>present into Home page?</em>)",
        $ThermometerEvent => "checkbox|propre|Add thermometer to event?",
        'redirect_to_hyperlink' => "checkbox|propre|Redirect article to Hyperlink?"
    )
);

$GLOBALS['champs_extra_proposes'] = Array (
    'articles' => Array (
        // tous : par defaut aucun champs extra sur les articles
        'tous' => 'redirect_to_hyperlink',
        // seul le champs extra "new_inspirational_stories" est propos� dans le secteur 42)
        /**
         * UpComming Events
         */
        '44' => $UpcomingEvent,
        '45' => $UpcomingEvent,
)
    );
感谢您的帮助

什么“不起作用”?您的
'45'=>数组看起来很好。您是如何尝试在电子数据之后访问这些值的

如果你要做

echo $GLOBALS['champs_extra_proposes']['articles']['44'];
你只需要得到“数组”,但是做什么呢

echo $GLOBALS['champs_extra_proposes']['articles']['44'][0];

如果您得到
$UpcomingEvent

的值,您可以拥有一个完全二维的数组-请参见此处:

或使用列表:


ah有道理。我得到的是“数组”,我必须深入挖掘。谢谢
echo $GLOBALS['champs_extra_proposes']['articles']['44'][0];
<?php

$info = array('coffee', 'brown', 'caffeine');

// Listing all the variables
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.\n";

// Listing some of them
list($drink, , $power) = $info;
echo "$drink has $power.\n";

// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!\n";

// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
?>