how to obtain all variable in php file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
coolcc
Forum Newbie
Posts: 5
Joined: Tue Jan 05, 2010 1:56 am

how to obtain all variable in php file

Post by coolcc »

hello everyone,ask a question.

have a php file.

Code: Select all

<?php
$a = 1;
$b = 'hello world';
$_SESSION['id'] = 31;
$_GET['string'] = 'intnumber';
have a test. one of question is :
have a function that similar "var_dump,print_r" can export variable , but the difference is export all of variable in the php file.

like use a function export

Code: Select all

[int]a=1
[string]b='hello world'
[int]$_SESSION['id']=31
[string]$_GET['string'] = 'intnumber';
this question is trouble.I try to read php file and use ereg search variable.but the answer isn't this. how to think everyone ?
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: how to obtain all variable in php file

Post by califdon »

So the purpose of the teacher asking the question is to see how much we know in the forum?
coolcc
Forum Newbie
Posts: 5
Joined: Tue Jan 05, 2010 1:56 am

Re: how to obtain all variable in php file

Post by coolcc »

I try to find a job . the examiner to ask me this question.I can't answer.so I come forums that hope anybody tell me the answer.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: how to obtain all variable in php file

Post by califdon »

coolcc wrote:I try to find a job . the examiner to ask me this question.I can't answer.so I come forums that hope anybody tell me the answer.
I sincerely wish you good luck in getting a job, but I will not help you try to fool somebody that you know something that you do not know. That is dishonest. They asked you that question to find out how much YOU know, not how much somebody in the forum knows.
coolcc
Forum Newbie
Posts: 5
Joined: Tue Jan 05, 2010 1:56 am

Re: how to obtain all variable in php file

Post by coolcc »

Thanks for your advice.I remember it.
Post Reply