I am trying to use a declared array in a function but that produces exactly nothing and I do not understand why.
<?php
$pages = array("missing-demos", "missing-downloads", "remove-demos");
function kz_check_adminmenu($action)
{
global $pages;
print_r($pages);
}
?>
Well the function is called as it is showing on the menu (I am using a CMS). However, echo-ing the method does print the desired output. I still do not understand why it doesn't show where it's executed.
Are you actually calling the function anywhere? :
<?php
$pages = array("missing-demos", "missing-downloads", "remove-demos");
function kz_check_adminmenu($action)
{
global $pages;
print_r($pages);
}
kz_check_adminmenu('test');
?>
This will ouput your array
You're not calling
your function.
Place this kz_check_adminmenu($action);
above your ?>
tag.
<?php
$pages = array("missing-demos", "missing-downloads", "remove-demos");
function kz_check_adminmenu($action)
{
global $pages;
print_r($pages);
}
kz_check_adminmenu($action);
?>