Re: How to path global object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 17 November 2004 00:01, Hongwei Li wrote:

> no values are displayed.  Apparently, $obj is not pathed to tsnext.php and
> tsshow.php (the second time), but $ind is.  What is wrong in the above
> codes?  Can somebody help me?

You seem to have a fundamental misunderstanding of what the keyword 'global' 
does. Read

  manual > Variables > Variable scope

study and *understand* the examples.

Now the reason why $ind seems to be passed onto tsnext.php is that:

1) global $ind defines a new variable that has a 'value' of NULL
2) $ind++ implicitly converts $ind to 0 (zero) then increments it
3) hence echo $ind shows 1

Summary: if you want to pass values from one page to another either do so 
using the URL, or by storing them in sessions.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
In war it is not men, but the man who counts.
  -- Napoleon
*/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux