Varibles not displaying

I have a page index.php which im trying to output a variable from a file im including but dosnt show:

index.php

<?php
include “languages/test.php”;
echo “$a”;
?>

languages/test.php

<?php
$a = “Hello World!”;
?>

if i take out the <?php ?> out of languages/test.php it outputs this on page $a = "Hello World! so i know its including the file

Try…


<?php
include("languages/test.php");
echo "$a";
?>

nope it dosnt seem to trasmit the varibles including from 2 files

Try removing php from the opening tag.

I’ve had this problem myself once or twice in the past but I can’t remember what on earth solved it (if I ever actually discovered it). All I know is my scripts work ok now.

Also in your include line change those double quotes for singles unless you’ve got $variables in there.

index.php


<?php
include ('languages/test.php');
echo $a . ' - from index file';
?>

languages/test.php


<?php
$a = "Hello World!";
echo $a . ' - from include file';
?>

See if that works