Php include with multidimensional array -
hello having trouble accessing multidimensional array on separate php page. example on index.php:
include 'scripts/test.php'; echo $test[1][1];
on test.php:
$test = array ( array("one", "two"), array("three", "four") );
wanted result:
four
this works fine when have array on same page echo, route correct because works fine when i'm using normal array on same test.php file.
did turn error reporting on? include work? code should work guess problem include
- make sure path correct
- make sure don't mix absolute , relative paths
you use $_server['document_root']
absolutely sure include right file:
<?php include($_server['document_root']."/scripts/test.php"); doit(); ?>
with code folder structure should this:
/scripts/test.php /index.php
but first of put @ top of index.php
error_reporting(e_all); ini_set('display_errors', '1');
Comments
Post a Comment