Re: [PHP] How can I track the value in php

2005-11-08 Thread Richard Lynch
On Sat, November 5, 2005 3:44 am, shining wrote:
 I am php beginner, I have a question:
 in my index page, I firstly inlcude_once a A.php file, where i defined
 an
 array, secondly I include another .php file named B.php, where I want
 to use
 the array, I have claimed it as global type, but it seems I can't
 retrieve
 any value from the array.

global only really makes sense in the context of INSIDE a function (or
method of a class)

So *where* did you declare it global?

You probably want to take out the global unless it is inside of a
function() { }


 So I want to ask:
 1. Is my use way right?
 2. if I want to track a variable value how it changed between php
 functions,
 besides I print out it's value, Is there any other way to do it?

There are IDEs you can use to watch variables as a script executes.

Zend IDE
Komodo

are the ones I remember as good from when I last looked at IDEs

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How can I track the value in php

2005-11-05 Thread shining
Hi,
I am php beginner, I have a question:
in my index page, I firstly inlcude_once a A.php file, where i defined an
array, secondly I include another .php file named B.php, where I want to use
the array, I have claimed it as global type, but it seems I can't retrieve
any value from the array.
So I want to ask:
1. Is my use way right?
2. if I want to track a variable value how it changed between php functions,
besides I print out it's value, Is there any other way to do it?
 Any suggestion and solution welcomed!
Thanks in advance.


Re: [PHP] How can I track the value in php

2005-11-05 Thread comex
 in my index page, I firstly inlcude_once a A.php file, where i defined an
 array, secondly I include another .php file named B.php, where I want to use
 the array, I have claimed it as global type, but it seems I can't retrieve
 any value from the array.

When you include a PHP file, it will be executed in the current
context (AFAIK).  If you're not including it from a function, then it
should be global automatically.  The global keyword makes variables in
functions global.

Maybe this is obvious, but are you sure you have ?php in the B.php?

What does var_dump($xxx); say, if $xxx is the array name?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php