|  | Posted by shimmyshack on 02/23/07 16:48 
On 23 Feb, 10:25, den <spam...@not.not> wrote:> If I have in this dir :\AA\BB\E\F\G\H\I\
 > one file.php with this variable:
 > $pip['value']=50;
 >
 > If I want to use in other dir's file \AA\BB\CC\
 >
 > 1) is possible?
 > but I not want to require or include the file.php.
 > I would like  use directly the variable.
 
 you have to open the file though right?
 so unless you treat it as atext file, and have the file like this:
 $pip['value']=50;
 $pip['value2']=150;
 $pip['value3']=150;
 and use file() to get an array, and split to by = ...
 or use regular expressions to extract the key=>values
 
 the easiest way is to include it, unless there's some reason you
 can't:
 
 file.php:
 
 <?php
 return array
 (
 'pip' => array
 (
 'host' => 'localhost',
 'user' => 'me',
 'pass' => 'strong_3st_in-the-wORld!',
 'db'   => 'cheese',
 'value' => 50,
 )
 );
 ?>
 
 then in which file you need it, use
 $arrayInfo = include( 'file.php' );
 print_r( $arrayInfo );
 
 but i understand it might not be what youre after
  Navigation: [Reply to this message] |