Skip to main content
gamedev.net
๐Ÿ”’ Locked ๐Ÿค– Godot

[web] PHP include variable scope

Started by kbiro Jul 16, 2005 at 5:11 PM 0 replies 600+ views
Original Post
kbiro
kbiro
Hello, yal I've been struggling with this problem for some time. I declare a $variable in my, say, index.php. I then include a file below the variable, and want to USE the $variable within that included file. Something like this... [start index.php] --------------- $something = good; include("otherfile.php"); ... [start otherfile.php] --------------- php echo $something; how would I, in this hypothetical scenario, get the other file to echo the variable $something ?
konForce
konForce
file1.php---------<?php   $x = 1;   include('file2.php');?>file2.php---------<?php   print $x;?>At the console# php file1.php1

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.