Forum Moderators: coopster

Message Too Old, No Replies

PHP variable

Php

         

samdyk

7:15 am on Jun 23, 2009 (gmt 0)

10+ Year Member



Hi i want to print all variable value from another included file.
i have two files.

words.php
================================================
$word_name = "User Name";
$word_group= "User group";
$word_sex = "sex";
================================================

print.php
================================================
include_once("words.php")
/*i want to write PHP script to print all variable from words.php*/
================================================

could anyone suggest any solution for that?

thanks,

Samdyk

jay7981

8:51 am on Jun 23, 2009 (gmt 0)

10+ Year Member



change your code from
include_once("words.php")

to require_once("words.php")

then build your script as if the vars were on that same page

jatar_k

1:02 pm on Jun 23, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



actually include_once and require_once do the exact same thing except require_once returns a fatal error if it fails, the same difference between include and require.

as jay7981 says though you proceed in the same way you would if the vars were on the same pag