laravel - Display chosen string in variable given in php

I need to display a string for each info given in variable.
Example variable which contain string
$sentence = "<audit><auLogNo></auLogNo><menuId></menuId><txnId></txnId><sortId></sortId><crLogNo>HTP1605809271</crLogNo><crResoDatetm>2016-08-15 10:03:26.0</crResoDatetm><showNewStartDate></showNewStartDate><endDatetime>2016-08-15 10:05:45.0</endDatetime><crGroupId>OSS</crGroupId><crFwdTo>7980</crFwdTo><crVendorRptno></crVendorRptno><crAction>01</crAction><crResolution>4G link status restored after YTL rebooting modem by remotely.</crResolution></audit>"
If I want to printcrLogNO
which string isHTP1605809271
, what do I need to echo thecrLogNo
data in variable given ?
Example display data
Log NO : HTP1605809271
Answer
Solution:
usesimplexml_load_string
$xml = simplexml_load_string($sentence, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: gd library extension not available with this php installation.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.