问题描述:

I need to set a variable = to an array element. $var = $ary[1]; does not work. ary[1]= "test". If that helps

网友答案:

PHP arrays are zero indexed, that may be your problem

    $ary = array("test");
    $var = $ary[0]

$var == "test"

网友答案:

confirm that your first initialize the array variable before using it like:

$ary=array();

Try this:

$ary[]= $var;

must use $ sign for var/arrays in php and you don't require 1 if a single value is inserted..

网友答案:

This is the way to set a variable with array elemen.

why it is not working , please check your array content .

http://php.net/manual/en/language.types.array.php

网友答案:

Try using

$content = array( "en" => "{$massage}" );
相关阅读:
Top