php-windows Digest 4 Dec 2009 12:18:44 -0000 Issue 3731
Topics (messages 29740 through 29745):
Re: Frustrated new php "developer" on Windows
29740 by: Jacob Bednarz; Graphic Designer
PHP Data driver Grid control
29741 by: Harpreet
Static array causing problem in recursion
29742 by: Midhun Girish
29743 by: Richard Quadling
29744 by: Midhun Girish
29745 by: Richard Quadling
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Landon,
When I first started out, I was pushed towards WAMP Server
(www.wampserver.com/en/) because of the ease of use for new comers. It helps
you along with the basic things you need to get started and it is pretty well
documented and support throughout the development community. All you need to do
is download and install.
After the installation has finished, all you need to do is point your browser
to http://localhost/ and it will take you to the root of the local server
environment. Then it is as simple as dropping files into the "www" directory to
see your files in action. Apache and MySQL are also included in the package so
when you are ready to move on it is there to play with.
Jacob.
Save on overseas calls and SMS direct from your mobile. gotalk mobile lets you
"Share the Moment" with family and friends overseas when and where you like.
Call rates on our Straight Talk Plus plan start from just 1/2c per min (plus
flagfall). Find out more at www.gotalkmobile.com.au
-----Original Message-----
From: Pierre Joye [mailto:[email protected]]
Sent: Thursday, 3 December 2009 3:06 AM
To: Landon Baine
Cc: [email protected]
Subject: Re: [PHP-WIN] Frustrated new php "developer" on Windows
hi,
On Wed, Dec 2, 2009 at 6:01 PM, Landon Baine <[email protected]> wrote:
> Any help would be greatly appreciated. Where does a new person start?
> Are there any good guides that you use to set up this type of local
> environment? Do I just install each piece...PHP, MySQL, etc. and work
> through it as I go? Am I looking for a "how to setup WIMP" that
> doesn't exist?
Reading the manual is amazingly helpful:
http://www.php.net/manual/en/install.windows.php
I would also suggest to simply use the MS Web Platform installer, it will setup
everything you need, even mysql or other non php.net softwares. It uses the
same installer than php.net (fetched from the same location).
For your other questions, that's not directly windows specific questions but
more about developments and deployments "strategy", there are dozen of
tutorials about these topics out there.
Cheers,
--
Pierre
http://blog.thepimp.net | http://www.libgd.org
--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Searching on the internet for a PHP data driver grid control and I see
many different options. Please suggest best way if used before. Thanks
I have like 100 some reports in my php application with data from a sql
server database. I would like to take my php app to a next level of
making it more fast and better looking. Any suggestions are welcome.
Thanks
--- End Message ---
--- Begin Message ---
Hello guys,
I was trying to use a recursive function to do a tree traversal.. i used a
static array to store the nodes at each recursion.. The function works
correctly if it is called only once during an execution.. but when i call it
twice or more, the nodes get appended to the array...hers the var dump of
the array...
Three:Array ( [0] => W4 )
Two:Array ( [0] => W4 [1] => W3 [2] => W4 )
One:Array ( [0] => W4 [1] => W3 [2] => W4 [3] => W2 [4] => W3 [5] => W4 )
I tried to reset() the array and all but not working..i am not able to
chnage the index of the $rootsarray back to 0... the new elelnts are added
at the end only...can anyone give me a push in the right direction?? Im
using PHP Version 5.2.9 in XAMPP... Hers the source...
public function getAllChildren($node,$level)
{
static $rootsarray=array();
static $levelcount;
$levelcount=$level;
$child=self::getChild($node);
if($child==''||$levelcount==0)
{
return 1;
}
else
{
$levelcount--;
$rootsarray[]=$child;
self::getAllChildren($child,$levelcount);
}
return $rootsarray;
}
Midhun Girish
--- End Message ---
--- Begin Message ---
2009/12/4 Midhun Girish <[email protected]>
>
> Hello guys,
> I was trying to use a recursive function to do a tree traversal.. i used a
> static array to store the nodes at each recursion.. The function works
> correctly if it is called only once during an execution.. but when i call it
> twice or more, the nodes get appended to the array...hers the var dump of
> the array...
> Three:Array ( [0] => W4 )
> Two:Array ( [0] => W4 [1] => W3 [2] => W4 )
> One:Array ( [0] => W4 [1] => W3 [2] => W4 [3] => W2 [4] => W3 [5] => W4 )
>
> I tried to reset() the array and all but not working..i am not able to
> chnage the index of the $rootsarray back to 0... the new elelnts are added
> at the end only...can anyone give me a push in the right direction?? Im
> using PHP Version 5.2.9 in XAMPP... Hers the source...
>
> public function getAllChildren($node,$level)
> {
> static $rootsarray=array();
> static $levelcount;
> $levelcount=$level;
> $child=self::getChild($node);
> if($child==''||$levelcount==0)
> {
> return 1;
> }
> else
> {
> $levelcount--;
> $rootsarray[]=$child;
> self::getAllChildren($child,$levelcount);
> }
> return $rootsarray;
>
> }
>
> Midhun Girish
Of course. The array is static. So the content is maintained between calls.
You need to know when to initialize it.
Something like ...
public function getAllChildren($node,$level,$firstCall=True)
{
static $rootsarray=array();
static $levelcount;
if($firstCall) {
$rootsarray=array();
}
$levelcount=$level;
$child=self::getChild($node);
if($child==''||$levelcount==0)
{
return 1;
}
else
{
$levelcount--;
$rootsarray[]=$child;
self::getAllChildren($child,$levelcount,False);
}
return $rootsarray;
}
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---
--- Begin Message ---
Hello ,
Richard Quadling thank you so much.. your trick worked... :) now its
working.. heres the modified code...
public function getAllChildren($node,$level,$firstCall=false)
>
> {
> static $rootsarray=array();
> static $levelcount;
> if($firstCall) {
> $rootsarray=array();
> }
> $levelcount=$level;
> $child=self::getChild($node);
> if($child==''||$levelcount==0)
> {
> return 1;
> }
> else
> {
> $levelcount--;
> $rootsarray[]=$child;
> self::getAllChildren($child,$levelcount,False);
> }
> return $rootsarray;
>
> }
>
>
and i call the function like :
$nodearray=tree::getAllChildren('W1',10,true);
Thank you so much for your support...
Midhun Girish
On Fri, Dec 4, 2009 at 3:18 PM, Richard Quadling
<[email protected]>wrote:
> 2009/12/4 Midhun Girish <[email protected]>
> >
> > Hello guys,
> > I was trying to use a recursive function to do a tree traversal.. i used
> a
> > static array to store the nodes at each recursion.. The function works
> > correctly if it is called only once during an execution.. but when i call
> it
> > twice or more, the nodes get appended to the array...hers the var dump of
> > the array...
> > Three:Array ( [0] => W4 )
> > Two:Array ( [0] => W4 [1] => W3 [2] => W4 )
> > One:Array ( [0] => W4 [1] => W3 [2] => W4 [3] => W2 [4] => W3 [5] => W4 )
> >
> > I tried to reset() the array and all but not working..i am not able to
> > chnage the index of the $rootsarray back to 0... the new elelnts are
> added
> > at the end only...can anyone give me a push in the right direction?? Im
> > using PHP Version 5.2.9 in XAMPP... Hers the source...
> >
> > public function getAllChildren($node,$level)
> > {
> > static $rootsarray=array();
> > static $levelcount;
> > $levelcount=$level;
> > $child=self::getChild($node);
> > if($child==''||$levelcount==0)
> > {
> > return 1;
> > }
> > else
> > {
> > $levelcount--;
> > $rootsarray[]=$child;
> > self::getAllChildren($child,$levelcount);
> > }
> > return $rootsarray;
> >
> > }
> >
> > Midhun Girish
>
> Of course. The array is static. So the content is maintained between calls.
>
> You need to know when to initialize it.
>
> Something like ...
>
> public function getAllChildren($node,$level,$firstCall=True)
> {
> static $rootsarray=array();
> static $levelcount;
> if($firstCall) {
> $rootsarray=array();
> }
> $levelcount=$level;
> $child=self::getChild($node);
> if($child==''||$levelcount==0)
> {
> return 1;
> }
> else
> {
> $levelcount--;
> $rootsarray[]=$child;
> self::getAllChildren($child,$levelcount,False);
> }
> return $rootsarray;
>
> }
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
--- End Message ---
--- Begin Message ---
2009/12/4 Midhun Girish <[email protected]>:
> Hello ,
>
> Richard Quadling thank you so much.. your trick worked... :) now its
> working.. heres the modified code...
>
> public function getAllChildren($node,$level,$firstCall=false)
>>
>> {
>> static $rootsarray=array();
>> static $levelcount;
>> if($firstCall) {
>> $rootsarray=array();
>> }
>> $levelcount=$level;
>> $child=self::getChild($node);
>> if($child==''||$levelcount==0)
>> {
>> return 1;
>> }
>> else
>> {
>> $levelcount--;
>> $rootsarray[]=$child;
>> self::getAllChildren($child,$levelcount,False);
>> }
>> return $rootsarray;
>>
>> }
>>
>
> and i call the function like :
>
> $nodearray=tree::getAllChildren('W1',10,true);
>
>
> Thank you so much for your support...
>
> Midhun Girish
>
>
> On Fri, Dec 4, 2009 at 3:18 PM, Richard Quadling <[email protected]>
> wrote:
>>
>> 2009/12/4 Midhun Girish <[email protected]>
>> >
>> > Hello guys,
>> > I was trying to use a recursive function to do a tree traversal.. i used
>> > a
>> > static array to store the nodes at each recursion.. The function works
>> > correctly if it is called only once during an execution.. but when i
>> > call it
>> > twice or more, the nodes get appended to the array...hers the var dump
>> > of
>> > the array...
>> > Three:Array ( [0] => W4 )
>> > Two:Array ( [0] => W4 [1] => W3 [2] => W4 )
>> > One:Array ( [0] => W4 [1] => W3 [2] => W4 [3] => W2 [4] => W3 [5] => W4
>> > )
>> >
>> > I tried to reset() the array and all but not working..i am not able to
>> > chnage the index of the $rootsarray back to 0... the new elelnts are
>> > added
>> > at the end only...can anyone give me a push in the right direction?? Im
>> > using PHP Version 5.2.9 in XAMPP... Hers the source...
>> >
>> > public function getAllChildren($node,$level)
>> > {
>> > static $rootsarray=array();
>> > static $levelcount;
>> > $levelcount=$level;
>> > $child=self::getChild($node);
>> > if($child==''||$levelcount==0)
>> > {
>> > return 1;
>> > }
>> > else
>> > {
>> > $levelcount--;
>> > $rootsarray[]=$child;
>> > self::getAllChildren($child,$levelcount);
>> > }
>> > return $rootsarray;
>> >
>> > }
>> >
>> > Midhun Girish
>>
>> Of course. The array is static. So the content is maintained between
>> calls.
>>
>> You need to know when to initialize it.
>>
>> Something like ...
>>
>> public function getAllChildren($node,$level,$firstCall=True)
>> {
>> static $rootsarray=array();
>> static $levelcount;
>> if($firstCall) {
>> $rootsarray=array();
>> }
>> $levelcount=$level;
>> $child=self::getChild($node);
>> if($child==''||$levelcount==0)
>> {
>> return 1;
>> }
>> else
>> {
>> $levelcount--;
>> $rootsarray[]=$child;
>> self::getAllChildren($child,$levelcount,False);
>> }
>> return $rootsarray;
>>
>> }
>>
>>
>> --
>> -----
>> Richard Quadling
>> "Standing on the shoulders of some very clever giants!"
>> EE : http://www.experts-exchange.com/M_248814.html
>> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
>> ZOPA : http://uk.zopa.com/member/RQuadling
>
>
Why did you change the default to False? This now requires _ALL_ calls
to the method to be amended.
Unless you wanted to preserve the incorrect behaviour...
Hmmm. BC is a PITA.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
--- End Message ---