I have a bootstrap script.
bootstrap.php
<?php
  $bootstrapFoo = 'foo';
and a main script.
main.php
<?php
  require_once 'bootstrap.php';
  print $bootstrapFoo; // this is working
  // I include a subscript
  include_once 'subscript.php';
subscript.php
<?php
  print $bootstrapFoo; // this is NOT working.
my solution :
<?php
  global $bootstrapFoo;
  print $bootstrapFoo; // now that's working
Is this the right way ?
ps: no duplicates found.
 
    