problem with include in PHP
- by EquinoX
I have a php file called Route.php which is located on:
/var/www/api/src/fra/custom/Action
and the file I want to include is in:
/var/www/api/src/fra/custom/
So what I have inside route php is an absolute path to the two php file I want to include:
<?php
include '/var/www/api/src/frapi/custom/myneighborlists.php';
include '/var/www/api/src/frapi/custom/mynodes.php';
............
...........
?>
These two file has an array of large amount of size that I want to use in Route.php. When I do vardump($global) it just returns NULL. What am I missing here?
UPDATE:
I did an echo on the included file and it prints something, so therefore it is included.. however I can't get access that array... when I do a vardump on the array, it just returns NULL!
I did add a global $myarray inside the function in which I want to access the array from the other php file
Sample myneighborlists.php:
<?php
$myarray = array(
1=> array(3351=>179),
2=> array(3264=>172, 3471=>139),
3=> array(3467=>226),
4=> array(3309=>211, 3469=>227),
5=> array(3315=>364, 3316=>144, 3469=>153),
6=> array(3305=>273, 3309=>171),
7=> array(3267=>624, 3354=>465, 3424=>411, 3437=>632),
8=> array(3302=>655, 3467=>212),
9=> array(3305=>216, 3306=>148, 3465=>505),
10=> array(3271=>273, 3472=>254),
11=> array(3347=>273, 3468=>262),
12=> array(3310=>237, 3315=>237));
?>