-2
저는 PHP를 사용하는 초보자이며 연관 배열을 사용하여 concantenate 할 문자열을 가지고 있습니다.하지만 아이디어가 있지만 배열 내의 배열을 사용합니다.PHP에서 연관 배열을 만드는 방법
$GLOBALS['batman'] = /*** Find the appropriate associative array. ***/;
function robin()
{
$z = 'flash';
return $z;
}
function ironman()
{
$answer = $GLOBALS['batman']['superman']['spiderman'][robin()][0]; // "The sum is " - this is a string
$answer .= $GLOBALS['batman']['superman']['spiderman'][robin()][1] // 14 - this is an integer
+ $GLOBALS['batman']['superman']['spiderman'][robin()]['hulk'][2]; // 11 - this is an integer
return $answer;
}
echo ironman(); // this should print out "The sum is 25"
초보자는 '$ GLOBALS'을 전혀 사용하지 않아야합니다. 그것에 대해 더 많이 배우는 동안, 당신은 당신도 그것을 필요로하지 않는다는 것을 깨닫게 될 것입니다. –
실제로 이것은 나의 서브에 대한 나의 좌석입니다. 그리고 이것은 PHP를 배울 수있는 첫 번째 시간이며, 제 교수는이 운동을 제공하고이 글로벌에 대해 혼란 스럽습니다. – user14