PHP output array with all key values of the same value

Source: Internet
Author: User
PHP output array values of all key values
, I want to output the value after all the keys are uses-permission android:name, what should I do? Uses-permission Android:name The number of bars is not fixed.
------Solution--------------------
X.xml














$xmlfile = ' x.xml ';
$data = Simplexml_load_file ($xmlfile);

$key = ' uses-permission ';
$arr = Array ();
foreach ($data $key as $uses _permission) {
$c = (string) $uses _permission->attributes (' Android ', true);
Array_push ($arr, $c);
}

Print_r ($arr);
?>


Output:
Array
(
[0] = Android.permission.ACCESS_COARSE_LOCATION
[1] = Android.permission.ACCESS_FINE_LOCATION
[2] = Android.permission.ACCESS_WIFI_STATE
[3] = Android.permission.ACCESS_NETWORK_STATE
[4] = Android.permission.CHANGE_WIFI_STATE
[5] = Android.permission.INTERNET
)
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.