, пожалуйста, помогите мне в новом массиве. Как читать определенные значения из многомерного массива с использованием php ниже - это массив. я хочу, чтобы прочитать значения [itemBody][div][0][p]
.THANKS заранееМногомерный массив
SimpleXMLElement Object
(
[@attributes] => Array
(
[toolName] => Eqiat
[toolVersion] => 0.7~git
[adaptive] => false
[timeDependent] => false
[identifier] => ITEM_b95e4391e33aa28561b01493b6e328f8
[title] => match the following
)
[stylesheet] => SimpleXMLElement Object
(
[@attributes] => Array
(
[href] => http://gauss.ecs.soton.ac.uk/eqiat/eqiat.css
[type] => text/css
[title] => Eqiat item styles, designed to override QTIEngine's output where appropriate
)
)
[responseDeclaration] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_0
[cardinality] => multiple
[baseType] => identifier
)
[correctResponse] => SimpleXMLElement Object
(
[value] => question_0_option_3
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_1
[cardinality] => multiple
[baseType] => identifier
)
[correctResponse] => SimpleXMLElement Object
(
[value] => question_1_option_2
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_2
[cardinality] => multiple
[baseType] => identifier
)
[correctResponse] => SimpleXMLElement Object
(
[value] => question_2_option_1
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_3
[cardinality] => multiple
[baseType] => identifier
)
[correctResponse] => SimpleXMLElement Object
(
[value] => question_3_option_0
)
)
)
[outcomeDeclaration] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
[cardinality] => single
[baseType] => integer
)
[defaultValue] => SimpleXMLElement Object
(
[value] => 0
)
)
[itemBody] => SimpleXMLElement Object
(
[div] => Array
(
[0] => SimpleXMLElement Object
(
[p] => Match The Following
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[class] => eqiat-emi
)
[ol] => SimpleXMLElement Object
(
[@attributes] => Array
(
[class] => emioptions
)
[li] => Array
(
[0] => bangalore
[1] => india
[2] => tiger
[3] => onion
)
)
[choiceInteraction] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[maxChoices] => 0
[minChoices] => 0
[shuffle] => false
[responseIdentifier] => RESPONSE_question_0
)
[prompt] => vegetable
[simpleChoice] => Array
(
[0] => A
[1] => B
[2] => C
[3] => D
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[maxChoices] => 0
[minChoices] => 0
[shuffle] => false
[responseIdentifier] => RESPONSE_question_1
)
[prompt] => animal
[simpleChoice] => Array
(
[0] => A
[1] => B
[2] => C
[3] => D
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[maxChoices] => 0
[minChoices] => 0
[shuffle] => false
[responseIdentifier] => RESPONSE_question_2
)
[prompt] => country
[simpleChoice] => Array
(
[0] => A
[1] => B
[2] => C
[3] => D
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[maxChoices] => 0
[minChoices] => 0
[shuffle] => false
[responseIdentifier] => RESPONSE_question_3
)
[prompt] => city
[simpleChoice] => Array
(
[0] => A
[1] => B
[2] => C
[3] => D
)
)
)
)
)
)
[responseProcessing] => SimpleXMLElement Object
(
[setOutcomeValue] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
[baseValue] => 0
)
[responseCondition] => Array
(
[0] => SimpleXMLElement Object
(
[responseIf] => SimpleXMLElement Object
(
[match] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_0
)
)
[correct] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_0
)
)
)
[setOutcomeValue] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
[sum] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
)
[baseValue] => 1
)
)
)
)
[1] => SimpleXMLElement Object
(
[responseIf] => SimpleXMLElement Object
(
[match] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_1
)
)
[correct] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_1
)
)
)
[setOutcomeValue] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
[sum] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
)
[baseValue] => 1
)
)
)
)
[2] => SimpleXMLElement Object
(
[responseIf] => SimpleXMLElement Object
(
[match] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_2
)
)
[correct] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_2
)
)
)
[setOutcomeValue] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
[sum] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
)
[baseValue] => 1
)
)
)
)
[3] => SimpleXMLElement Object
(
[responseIf] => SimpleXMLElement Object
(
[match] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_3
)
)
[correct] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => RESPONSE_question_3
)
)
)
[setOutcomeValue] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
[sum] => SimpleXMLElement Object
(
[variable] => SimpleXMLElement Object
(
[@attributes] => Array
(
[identifier] => SCORE
)
)
[baseValue] => 1
)
)
)
)
)
)
)
Это объект не массив. Преобразуйте в массив и получите доступ к значению. –
Так ты сдался или один из них решил это ??? – AbraCadaver
спасибо За вашу помощь я получил эту работу ниже мое решение function object2array ($ object) { return json_decode (json_encode ($ object), true); } $ data = object2array (simplexml_load_string ($ xml1)); echo '
'; // echo $ data [itembody] [div] [0] [p]; echo $ data [itemBody] [div] [0] [p]; – Anup