Re: [PHP] for the security minded web developer - secure way to login?

2009-02-15 Thread German Geek
Hi All again,

What makes it so expensive to have a certificate? I mean, wouldn't it be
possible to setup a new authority that doesn't charge as much or nothing at
all? Wouldn't the major browsers be willing to support an authority that is
free or costs next to nothing? I pay about $200 a year for my virtual
server, so if i only issue 200 certifcates and charge a dollar each i
wouldn't loose money. I have a v-server on the Internet and wouldn't mind
setting it up as a free authority or even one based on donations. Or is
there going to be so much traffic and processing that it wouldn't be able to
handle it? Cannot be that bad because it needs to compute the authentication
only periodically (once a year or so for each) and each time a user hits a
page it is only checked which would only be a couple of bytes traffic (per
domain?).

Please enlighten me why it is so expensive? Is it maybe just the hassle of
setting it up?

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
Fred Allen  - "California is a fine place to live - if you happen to be an
orange."

2009/2/16 Michael A. Peters 

> German Geek wrote:
>
>> OK, i hear about this self signed certificate. Whenever i signed anything
>> it
>> just came up with all these warnings in FF which confuses users and i
>> think
>> is not good at all. Can someone paste a link in here to a website with a
>> self signed cert please? Would like to see if there are any warnings etc.
>> Thanks.
>>
>
> There still are all the warnings.
>
> There are some cheap (and free) CA's that FireFox recognizes so it still is
> possible to use SSL and not have the firefox 3 warning hell, but things like
> linksys routers are still problematic.
>
> https://www.scientificlinux.org/
>
> Demonstrates the problem in FireFox 3.
> They use a self-signed cert.
>


Re: [PHP] for the security minded web developer - secure way to login?

2009-02-15 Thread Michael A. Peters

German Geek wrote:

OK, i hear about this self signed certificate. Whenever i signed anything it
just came up with all these warnings in FF which confuses users and i think
is not good at all. Can someone paste a link in here to a website with a
self signed cert please? Would like to see if there are any warnings etc.
Thanks.


There still are all the warnings.

There are some cheap (and free) CA's that FireFox recognizes so it still 
is possible to use SSL and not have the firefox 3 warning hell, but 
things like linksys routers are still problematic.


https://www.scientificlinux.org/

Demonstrates the problem in FireFox 3.
They use a self-signed cert.

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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-15 Thread German Geek
OK, i hear about this self signed certificate. Whenever i signed anything it
just came up with all these warnings in FF which confuses users and i think
is not good at all. Can someone paste a link in here to a website with a
self signed cert please? Would like to see if there are any warnings etc.
Thanks.

Tim
Tim-Hinnerk Heuer

http://www.ihostnz.com
Jay London  - "My father would take me to the playground, and put me on mood
swings."

2009/2/15 Michael A. Peters 

> Sudheer wrote:
>
>> Michael A. Peters wrote:
>>
>>>
>>> Sites (like mine) that don't want to pay a certificate authority can use
>>> a self-signed cert. Even Red Hat does for some of their stuff (IE I believe
>>> their bugzilla server)
>>>
>>>  Firefox scares its users when they encounter a website with self signed
>> certificate. If your website users aren't worried about the warning Firefox
>> throws at them, self signed cert works well.
>>
>>
>>
> Yeah it does, hopefully they fix it.
> What scares me is allowing sites I have no reason to trust as non malicious
> and have no reason to trust as properly secured against XSS injection to
> load scripts that execute on my machine.
>
> People who use Firefox may be scared by the absurd warning FireFox 3 uses
> (something I've complained about to them) - other than informing users of
> the issue and hoping some read it, not much I can do about that. Hopefully
> FireFox will fix the issue and do something like what opera does (except the
> cert for session if you just click OK, accept it permanently if you click
> the security tab and check a box first).
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Michael A. Peters

Sudheer wrote:

Michael A. Peters wrote:


Sites (like mine) that don't want to pay a certificate authority can 
use a self-signed cert. Even Red Hat does for some of their stuff (IE 
I believe their bugzilla server)


Firefox scares its users when they encounter a website with self signed 
certificate. If your website users aren't worried about the warning 
Firefox throws at them, self signed cert works well.





Yeah it does, hopefully they fix it.
What scares me is allowing sites I have no reason to trust as non 
malicious and have no reason to trust as properly secured against XSS 
injection to load scripts that execute on my machine.


People who use Firefox may be scared by the absurd warning FireFox 3 
uses (something I've complained about to them) - other than informing 
users of the issue and hoping some read it, not much I can do about 
that. Hopefully FireFox will fix the issue and do something like what 
opera does (except the cert for session if you just click OK, accept it 
permanently if you click the security tab and check a box first).


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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Sudheer




Firefox scares its users when they encounter a website with self 
signed certificate. If your website users aren't worried about the 
warning Firefox throws at them, self signed cert works well.




I just realized Dotan Cohen already mentioned this.



--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Sudheer

Michael A. Peters wrote:

German Geek wrote:

Hi gang,

Was just thinking of a cheap solution for sites that don't require 
absolute
security. A SSL cert cost about $150 a year. Sites like facebook 
could use
this... 


Sites (like mine) that don't want to pay a certificate authority can 
use a self-signed cert. Even Red Hat does for some of their stuff (IE 
I believe their bugzilla server)


Firefox scares its users when they encounter a website with self signed 
certificate. If your website users aren't worried about the warning 
Firefox throws at them, self signed cert works well.



--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Michael A. Peters

German Geek wrote:

Hi gang,

Was just thinking of a cheap solution for sites that don't require absolute
security. A SSL cert cost about $150 a year. Sites like facebook could use
this... 


Sites (like mine) that don't want to pay a certificate authority can use 
a self-signed cert. Even Red Hat does for some of their stuff (IE I 
believe their bugzilla server)


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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread German Geek
Hi gang,

Was just thinking of a cheap solution for sites that don't require absolute
security. A SSL cert cost about $150 a year. Sites like facebook could use
this... Of course it's not for banks etc.

You could degrade gracefully when javascript is turned off to just sending
the form and checking the password normally if the first test fails which
would happen anyway wouldnt it? ...

Mainly this was just ment to be a proof of concept. An alternative to SSL
for those who have more time than $$ and not quite so high a security
requirement.

Of course SSL is better! Duh! Just wanted to give you guys something to
think about. The password would not be given away like this would it? It
just makes it a little more difficult for script kiddies. They would have to
have a keylogger running or steal the session. :P

Regards,
Tim

Tim-Hinnerk Heuer

http://www.ihostnz.com
Mike Ditka  - "If God had wanted man to play soccer, he wouldn't have given
us arms."

2009/2/15 Michael A. Peters 

> Dotan Cohen wrote:
>
>
>> Have you seen the fit Firefox 3 makes for self-signed certs? So far as
>> the end user is concerned, the site is inaccesible.
>>
>>
> Yes I have.
> That's why on my site I have an instruction page - and a demonstration of
> how Opera does it, which is just as secure and less of a PITA, and a
> suggestion that users go ahead and try Opera - something I never did before
> FF messed up the self signed SSL process.
>
> The FF3 really bugged me -
>
> 1) The purpose of SSL is to provide public/private key encryption.
> 2) The purpose of signing is so that they know you are really you on future
> visits.
> 3) The purpose of certificate authorities is so that they know you are you
> on the first visit.
>
> Many web sites benefit from the first two without needing the complexity of
> the third, a concept FireFox seems to have lost.
>
> I don't need the paperwork hassle etc. for the few sites I run - I just
> need a way for a user to authenticate so I can give 'em a session cookie, no
> sensitive data is ever collected. Ah well.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Michael A. Peters

Dotan Cohen wrote:



Have you seen the fit Firefox 3 makes for self-signed certs? So far as
the end user is concerned, the site is inaccesible.



Yes I have.
That's why on my site I have an instruction page - and a demonstration 
of how Opera does it, which is just as secure and less of a PITA, and a 
suggestion that users go ahead and try Opera - something I never did 
before FF messed up the self signed SSL process.


The FF3 really bugged me -

1) The purpose of SSL is to provide public/private key encryption.
2) The purpose of signing is so that they know you are really you on 
future visits.
3) The purpose of certificate authorities is so that they know you are 
you on the first visit.


Many web sites benefit from the first two without needing the complexity 
of the third, a concept FireFox seems to have lost.


I don't need the paperwork hassle etc. for the few sites I run - I just 
need a way for a user to authenticate so I can give 'em a session 
cookie, no sensitive data is ever collected. Ah well.


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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Dotan Cohen
> I think just use a flippin' ssl server and be done with it.
>

++$i

> When I go to a website that requires me to let them execute JavaScript I
> rarely go back.
>

Many people do this, I hope that the OP realizes this.

> You can use SSL for the login and only the login - I know that it means
> either using a self signed cert or paying big bucks, for anything with
> e-commerce you want to pay big bucks for a cert, there is no other option.
> For anything not e-commerce, using a self signed cert seems a lot more
> secure to me than having the browser grab some salt off your server, use
> javascript to encrypt the pass, and then sending it back.
>

Have you seen the fit Firefox 3 makes for self-signed certs? So far as
the end user is concerned, the site is inaccesible.

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü


Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Per Jessen
Michael A. Peters wrote:

> German Geek wrote:
> 
>  > What do you think?
> 
> I think just use a flippin' ssl server and be done with it.
> 

That was my thought too. 

> You can use SSL for the login and only the login - I know that it
> means either using a self signed cert or paying big bucks, for
> anything with e-commerce you want to pay big bucks for a cert, there
> is no other option. 

http://www.cacert.org/


/Per

-- 
Per Jessen, Zürich (0.2°C)


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



Re: [PHP] for the security minded web developer - secure way to login?

2009-02-14 Thread Michael A. Peters

German Geek wrote:

> What do you think?

I think just use a flippin' ssl server and be done with it.

When I go to a website that requires me to let them execute JavaScript I 
rarely go back.


You can use SSL for the login and only the login - I know that it means 
either using a self signed cert or paying big bucks, for anything with 
e-commerce you want to pay big bucks for a cert, there is no other 
option. For anything not e-commerce, using a self signed cert seems a 
lot more secure to me than having the browser grab some salt off your 
server, use javascript to encrypt the pass, and then sending it back.


Public / Private key is the way to go, and self signed cert still gives 
you that, the only issue is the user get's a warning the first time they 
connect to the server - and have to manually accept your cert.


You may make the password a little more difficult to sniff by sending 
some salt to the client and using js to make a password hash, but the 
bottom line is a user has no reason to trust a login is secure if you 
don't use SSL and every reason not to trust that it is secure, so use 
SSL if you want to provide secure login and don't cripple your site by 
having the audacity to require users to allow you to execute code on 
their machine in order to use your website. It will drive some users away.


Not exactly what you asked, but it is my opinion.

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



Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Stut

On 30 Sep 2008, at 17:40, Nathan Rixham wrote:

Stut wrote:

Consider this...
file1.php:
package arse
{
   class bandit
   {
   ...
   }
}
package nipple
{
   class clamp
   {
   ...
   }
}
file2.php:
import file1 as chest;
Which package have I aliased as chest in file2.php?
This could be solved using "import file1 into chest" which  
presumably would then give me chest::arse::bandit and  
chest::nipple::clamp but that's pretty nasty.


see I'd lock it to one class per file; multiple files/classes per  
package :) I think one should always keep their arse and nipple  
seperate.


consider:

file: /classes/net/stut/body/arse.php
package net.stut.body.arse
{
   class bandit
   {
   ...
   }
}

file: /classes/net/stut/body/nipple.php
package net.stut.body.nipple
{
   class clamp
   {
   ...
   }
}

file: /classes/net/stut/body/chest.php
package /classes/net/stut/body/chest
{
   import net.stut.body.nipple;
   class chest
   {
   ...
   }
}

or

file: /classes/net/stut/body/chest.php
import net.stut.body.nipple;
$u = new arse::bandit;

whhiihhh leads me back to my earlier q of  
how would this new style work when doing things the procedural way..  
even the above three lines; any potential problems there?


Sorry, I must have missed this question. Since namespaces are  
effectively another level or organisation above classes there's really  
no issue at all with only having in them, at least conceptually. In  
fact I'd guess you'd be implementing limitations where no limitation  
is necessary if you were to limit namespace contents to classes. I  
would hope the current PHP implementation does not have this  
limitation but I've not had much time to play with it yet.


-Stut

--
http://stut.net/

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



Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread tedd

At 3:36 PM +0100 9/30/08, Stut wrote:
There was a cracking suggestion a week or so ago that the $ prefix 
for variables should be removed. Can you imagine the community 
backlash at such a pointless change!!


-Stut


Well... there's always one. I try hard not to be it.  :-)

I just learned the other day that javascript variables can have the $ 
prefix. Here I've been writing js for years and never knew that.


Languages keep looking more and more alike -- but then again, without 
my glasses everything does.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Nathan Rixham

Stut wrote:

On 30 Sep 2008, at 16:57, Nathan Rixham wrote:

Stut wrote:

On 30 Sep 2008, at 14:00, Nathan Rixham wrote:

Stut wrote:

On 29 Sep 2008, at 12:47, Nathan Rixham wrote:

import com.anotherdom.MysqlDbHandler as DbHandlerA;
import com.somedom.DbHandler as DbHandlerB; # "as" makes this easier
import com.mydom.thatpackage.RssParser; # we don't have to "as"
Would this then be available as RssParser:: or would you need to 
specify the full name.

just RssParser.. I'd see "import" being a replacement for include
import com.mydom.thatpackage.RssParser;
same as
import '/classpath/com/mydom/thatpackage/RssParser.php';


Where did /classpath come from? Seems to me that's no better than 
simply using include. I see no value in replacing / with . in the path.
/classpath was purely an illustration; the idea (or my thought behind) 
replacing / with . and using packages as such; would be do give all of 
us developers a set standard for file hierarchy / storing classes - 
think java classes/packages actionscript 3 classes; never any cross 
over; doesn't matter if 3 different companies all have a 
/db/handler.php as it's always saved in 
net/companydomain/packagename/db/handler.php - again back to the 
classpath; illustrating a set "class root" directory for all classes.


/classes/
/modules/
/templates/
etc; but only defining /classes" at this time

to me anyways; this form of working in java and actionscript 3 (and 
some other languages) makes sense and keeps things nice and standard.


Hasn't this already been attempted with PEAR? Don't get me wrong, I 
really like the idea. And when phar becomes ubiquitous I would love to 
see this adopted as a standard installation structure for libraries but 
I can't see it happening, at least not enough for it to change the 
behaviour of file inclusion. But you can hope I guess.




not sure.. for some reason I always bypass pear whenever possible; 
probably because I like the excuse to re-invent the wheel :)



import net.php.pecl.Tidy into TidySpace; # "into namespace"
import org.nicedom.alwaysusethese.*; # why not?

How does PHP work out where these "packages" are?

see above + in this case compiler would loop through the directory
'org/nicedom/alway/usethese/' and include all files (one class per 
file)


The ability to have multiple namespaces per file leads to issues with 
the "as" or "into" syntax. Which namespace from that file are you 
aliasing? This ambiguity is a killer.
internal virtual namespace within that class only; for internal use by 
that class; non accessible to anything else - to allow for function 
libraries that aren't in packages / classes and could have conflicting 
function names. Rather than including a couple of files normally; it 
makes sense to me to import the contents of these function libs into a 
temporary internal namespace. I fear I have not the words; but *I* 
know I mean :p


Consider this...

file1.php:
package arse
{
class bandit
{
...
}
}
package nipple
{
class clamp
{
...
}
}

file2.php:
import file1 as chest;

Which package have I aliased as chest in file2.php?

This could be solved using "import file1 into chest" which presumably 
would then give me chest::arse::bandit and chest::nipple::clamp but 
that's pretty nasty.




see I'd lock it to one class per file; multiple files/classes per 
package :) I think one should always keep their arse and nipple seperate.


consider:

file: /classes/net/stut/body/arse.php
package net.stut.body.arse
{
class bandit
{
...
}
}

file: /classes/net/stut/body/nipple.php
package net.stut.body.nipple
{
class clamp
{
...
}
}

file: /classes/net/stut/body/chest.php
package /classes/net/stut/body/chest
{
import net.stut.body.nipple;
class chest
{
...
}
}

or

file: /classes/net/stut/body/chest.php
import net.stut.body.nipple;
$u = new arse::bandit;

whhiihhh leads me back to my earlier q of how 
would this new style work when doing things the procedural way.. even 
the above three lines; any potential problems there?



public class MyClass # visibility on classes
{
 private $dba:DbHandlerA = new DbHandlerA();
 private $dbb:DbHandlerB = new DbHandlerB();
Can't do this. This would require the compilation phase to execute 
code. This is what constructors were made for.

my mistake I meant:
private DbHandlerA $dba = new DbHandlerA();
private DbHandlerB $dbb = new DbHandlerB();
scope type variablename = new class();

obviously calling __construct as per normal.


Except you can't, like I said. Try it. You cannot execute code during 
variable declaration in classes, you can only initialise to literal 
values.
indeed you can't; but you can in other languages and this is all 
entirely functional; tis a feature of as3 that I like :)


This is a pretty fundamental limitation of the way PHP works. I don't 
see it changing anytime soon, and I'm pretty happy about that. 
Initialisation

Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Stut

On 30 Sep 2008, at 16:57, Nathan Rixham wrote:

Stut wrote:

On 30 Sep 2008, at 14:00, Nathan Rixham wrote:

Stut wrote:

On 29 Sep 2008, at 12:47, Nathan Rixham wrote:

import com.anotherdom.MysqlDbHandler as DbHandlerA;
import com.somedom.DbHandler as DbHandlerB; # "as" makes this  
easier

import com.mydom.thatpackage.RssParser; # we don't have to "as"
Would this then be available as RssParser:: or would you need to  
specify the full name.

just RssParser.. I'd see "import" being a replacement for include
import com.mydom.thatpackage.RssParser;
same as
import '/classpath/com/mydom/thatpackage/RssParser.php';


Where did /classpath come from? Seems to me that's no better than  
simply using include. I see no value in replacing / with . in the  
path.
/classpath was purely an illustration; the idea (or my thought  
behind) replacing / with . and using packages as such; would be do  
give all of us developers a set standard for file hierarchy /  
storing classes - think java classes/packages actionscript 3  
classes; never any cross over; doesn't matter if 3 different  
companies all have a /db/handler.php as it's always saved in net/ 
companydomain/packagename/db/handler.php - again back to the  
classpath; illustrating a set "class root" directory for all classes.


/classes/
/modules/
/templates/
etc; but only defining /classes" at this time

to me anyways; this form of working in java and actionscript 3 (and  
some other languages) makes sense and keeps things nice and standard.


Hasn't this already been attempted with PEAR? Don't get me wrong, I  
really like the idea. And when phar becomes ubiquitous I would love to  
see this adopted as a standard installation structure for libraries  
but I can't see it happening, at least not enough for it to change the  
behaviour of file inclusion. But you can hope I guess.



import net.php.pecl.Tidy into TidySpace; # "into namespace"
import org.nicedom.alwaysusethese.*; # why not?

How does PHP work out where these "packages" are?

see above + in this case compiler would loop through the directory
'org/nicedom/alway/usethese/' and include all files (one class per  
file)


The ability to have multiple namespaces per file leads to issues  
with the "as" or "into" syntax. Which namespace from that file are  
you aliasing? This ambiguity is a killer.
internal virtual namespace within that class only; for internal use  
by that class; non accessible to anything else - to allow for  
function libraries that aren't in packages / classes and could have  
conflicting function names. Rather than including a couple of files  
normally; it makes sense to me to import the contents of these  
function libs into a temporary internal namespace. I fear I have not  
the words; but *I* know I mean :p


Consider this...

file1.php:
package arse
{
class bandit
{
...
}
}
package nipple
{
class clamp
{
...
}
}

file2.php:
import file1 as chest;

Which package have I aliased as chest in file2.php?

This could be solved using "import file1 into chest" which presumably  
would then give me chest::arse::bandit and chest::nipple::clamp but  
that's pretty nasty.



public class MyClass # visibility on classes
{
 private $dba:DbHandlerA = new DbHandlerA();
 private $dbb:DbHandlerB = new DbHandlerB();
Can't do this. This would require the compilation phase to  
execute code. This is what constructors were made for.

my mistake I meant:
private DbHandlerA $dba = new DbHandlerA();
private DbHandlerB $dbb = new DbHandlerB();
scope type variablename = new class();

obviously calling __construct as per normal.


Except you can't, like I said. Try it. You cannot execute code  
during variable declaration in classes, you can only initialise to  
literal values.
indeed you can't; but you can in other languages and this is all  
entirely functional; tis a feature of as3 that I like :)


This is a pretty fundamental limitation of the way PHP works. I don't  
see it changing anytime soon, and I'm pretty happy about that.  
Initialisations like this are only really useful in static classes  
where you don't have a constructor. Personally I'd not use this  
ability if it did exist because I prefer to use constructors to group  
initialisations together but each to their own.





-Stut

--
http://stut.net/

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



Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Nathan Rixham

Stut wrote:

On 30 Sep 2008, at 14:00, Nathan Rixham wrote:

Stut wrote:

On 29 Sep 2008, at 12:47, Nathan Rixham wrote:

import com.anotherdom.MysqlDbHandler as DbHandlerA;
import com.somedom.DbHandler as DbHandlerB; # "as" makes this easier
import com.mydom.thatpackage.RssParser; # we don't have to "as"
Would this then be available as RssParser:: or would you need to 
specify the full name.

just RssParser.. I'd see "import" being a replacement for include
import com.mydom.thatpackage.RssParser;
same as
import '/classpath/com/mydom/thatpackage/RssParser.php';


Where did /classpath come from? Seems to me that's no better than 
simply using include. I see no value in replacing / with . in the path.
/classpath was purely an illustration; the idea (or my thought behind) 
replacing / with . and using packages as such; would be do give all of 
us developers a set standard for file hierarchy / storing classes - 
think java classes/packages actionscript 3 classes; never any cross 
over; doesn't matter if 3 different companies all have a /db/handler.php 
as it's always saved in net/companydomain/packagename/db/handler.php - 
again back to the classpath; illustrating a set "class root" directory 
for all classes.


/classes/
/modules/
/templates/
etc; but only defining /classes" at this time

to me anyways; this form of working in java and actionscript 3 (and some 
other languages) makes sense and keeps things nice and standard.



import net.php.pecl.Tidy into TidySpace; # "into namespace"
import org.nicedom.alwaysusethese.*; # why not?

How does PHP work out where these "packages" are?

see above + in this case compiler would loop through the directory
'org/nicedom/alway/usethese/' and include all files (one class per file)


The ability to have multiple namespaces per file leads to issues with 
the "as" or "into" syntax. Which namespace from that file are you 
aliasing? This ambiguity is a killer.
internal virtual namespace within that class only; for internal use by 
that class; non accessible to anything else - to allow for function 
libraries that aren't in packages / classes and could have conflicting 
function names. Rather than including a couple of files normally; it 
makes sense to me to import the contents of these function libs into a 
temporary internal namespace. I fear I have not the words; but *I* know 
I mean :p





public class MyClass # visibility on classes
{
  private $dba:DbHandlerA = new DbHandlerA();
  private $dbb:DbHandlerB = new DbHandlerB();
Can't do this. This would require the compilation phase to execute 
code. This is what constructors were made for.

my mistake I meant:
private DbHandlerA $dba = new DbHandlerA();
private DbHandlerB $dbb = new DbHandlerB();
scope type variablename = new class();

obviously calling __construct as per normal.


Except you can't, like I said. Try it. You cannot execute code during 
variable declaration in classes, you can only initialise to literal 
values.
indeed you can't; but you can in other languages and this is all 
entirely functional; tis a feature of as3 that I like :)



  {
if( TidySpace::tidy_is_xml( $xml ) ) { #namespace function call
  $this->xmlString = TidySpace::tidy_repair_string( $xml );
One would hope that when namespaces are ubiquitous there will be no 
need to prefix functions with package identifiers.


surely that would defeat the point of namespaces.. if the function 
exists in two or more namespaces/packages then namespace prefix is 
required.


I'm not referring to the namespace prefix, I'm referring to the tidy_ 
prefix.
ahhh I misread; yeah that's the idea of the "import file into namespace" 
- we could all loose those function prefixes :) however there would 
still be old function libraries written like this we may need to import 
[/include/]





with NAMESPACE {

}
syntax would be cool as well


Agreed.


+1 from me too [again lol]
all purely a made up example; I'd be interested to here any 
comments or what your ideal language (/modified php) would look like.
I've never really thought about how I'd like a languages syntax to 
be, I've just accepted the way it is. Having said that I've built a 
couple of compilers in my time and for the most part they were a 
combination of C, C++ and Perl, much like PHP. So in that respect 
PHP is the one that clearly makes the most sense to me for 
procedural languages.
In terms of OO I've always liked the Objective-C way of doing 
things. It seems more natural than the C++ syntax.

-Stut


why not throw out your ideal/made up procedural php language syntax; 
would be interested to see how what I as an OO dev would prefer 
compares to what you as a procedural dev would prefer.


Unfortunately they've all been proprietary, but the basic syntax for 
all of them was similar to PHP and they didn't have complex concepts 
like packages or classes and only one of them had functions.


thanks for the reply - probably a wasted convo but an interesting one 
that may lead somewhere!


Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Stut

On 30 Sep 2008, at 14:00, Nathan Rixham wrote:

Stut wrote:

On 29 Sep 2008, at 12:47, Nathan Rixham wrote:

import com.anotherdom.MysqlDbHandler as DbHandlerA;
import com.somedom.DbHandler as DbHandlerB; # "as" makes this easier
import com.mydom.thatpackage.RssParser; # we don't have to "as"
Would this then be available as RssParser:: or would you need to  
specify the full name.

just RssParser.. I'd see "import" being a replacement for include
import com.mydom.thatpackage.RssParser;
same as
import '/classpath/com/mydom/thatpackage/RssParser.php';


Where did /classpath come from? Seems to me that's no better than  
simply using include. I see no value in replacing / with . in the path.



import net.php.pecl.Tidy into TidySpace; # "into namespace"
import org.nicedom.alwaysusethese.*; # why not?

How does PHP work out where these "packages" are?

see above + in this case compiler would loop through the directory
'org/nicedom/alway/usethese/' and include all files (one class per  
file)


The ability to have multiple namespaces per file leads to issues with  
the "as" or "into" syntax. Which namespace from that file are you  
aliasing? This ambiguity is a killer.



public class MyClass # visibility on classes
{
  private $dba:DbHandlerA = new DbHandlerA();
  private $dbb:DbHandlerB = new DbHandlerB();
Can't do this. This would require the compilation phase to execute  
code. This is what constructors were made for.

my mistake I meant:
private DbHandlerA $dba = new DbHandlerA();
private DbHandlerB $dbb = new DbHandlerB();
scope type variablename = new class();

obviously calling __construct as per normal.


Except you can't, like I said. Try it. You cannot execute code during  
variable declaration in classes, you can only initialise to literal  
values.



  {
if( TidySpace::tidy_is_xml( $xml ) ) { #namespace function call
  $this->xmlString = TidySpace::tidy_repair_string( $xml );
One would hope that when namespaces are ubiquitous there will be no  
need to prefix functions with package identifiers.


surely that would defeat the point of namespaces.. if the function  
exists in two or more namespaces/packages then namespace prefix is  
required.


I'm not referring to the namespace prefix, I'm referring to the tidy_  
prefix.



with NAMESPACE {

}
syntax would be cool as well


Agreed.

all purely a made up example; I'd be interested to here any  
comments or what your ideal language (/modified php) would look  
like.
I've never really thought about how I'd like a languages syntax to  
be, I've just accepted the way it is. Having said that I've built a  
couple of compilers in my time and for the most part they were a  
combination of C, C++ and Perl, much like PHP. So in that respect  
PHP is the one that clearly makes the most sense to me for  
procedural languages.
In terms of OO I've always liked the Objective-C way of doing  
things. It seems more natural than the C++ syntax.

-Stut


why not throw out your ideal/made up procedural php language syntax;  
would be interested to see how what I as an OO dev would prefer  
compares to what you as a procedural dev would prefer.


Unfortunately they've all been proprietary, but the basic syntax for  
all of them was similar to PHP and they didn't have complex concepts  
like packages or classes and only one of them had functions.


thanks for the reply - probably a wasted convo but an interesting  
one that may lead somewhere!


Namespace syntax discussions are ongoing on the internals list.  
Nothing has been officially released yet so nothing has been  
finalised. There was a cracking suggestion a week or so ago that the $  
prefix for variables should be removed. Can you imagine the community  
backlash at such a pointless change!!


-Stut

--
http://stut.net/

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



Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Nathan Rixham

Stut wrote:

On 29 Sep 2008, at 12:47, Nathan Rixham wrote:
Last week I got to thinking about PHP vs other languages.. sparing the 
details this is what I decided I'd like my code to look like :) [what 
*I* /as an OO developer/ need(?want)]




Looks a lot like Java, not that that's a bad thing.


{


Completely agree that multiple namespaces per file should be allowed, 
and using curly brackets is the obvious syntax.



 import com.anotherdom.MysqlDbHandler as DbHandlerA;
 import com.somedom.DbHandler as DbHandlerB; # "as" makes this easier
 import com.mydom.thatpackage.RssParser; # we don't have to "as"


Would this then be available as RssParser:: or would you need to specify 
the full name.

just RssParser.. I'd see "import" being a replacement for include
import com.mydom.thatpackage.RssParser;
same as
import '/classpath/com/mydom/thatpackage/RssParser.php';




 import net.php.pecl.Tidy into TidySpace; # "into namespace"
 import org.nicedom.alwaysusethese.*; # why not?


How does PHP work out where these "packages" are?

see above + in this case compiler would loop through the directory
'org/nicedom/alway/usethese/' and include all files (one class per file)



 public class MyClass # visibility on classes
 {
   private $dba:DbHandlerA = new DbHandlerA();
   private $dbb:DbHandlerB = new DbHandlerB();


Can't do this. This would require the compilation phase to execute code. 
This is what constructors were made for.

my mistake I meant:
private DbHandlerA $dba = new DbHandlerA();
private DbHandlerB $dbb = new DbHandlerB();
scope type variablename = new class();

obviously calling __construct as per normal.



Personally I'd prefer the fairly standard "type varname" order rather 
than the "varname:type" you have here.

agreed - thought that as an after thought; no need to change everything!




   protected $xmlString:String;

   public function __construct( String $xml ):void #return types


Here you've switched to the "type varname" order for the parameters and 
gone back to ":type" for the return value. Why not just "function x(type 
varname) type" ?


see above.. "type $variable" is better [well matter of preference, no 
need to change] :)





   {
 if( TidySpace::tidy_is_xml( $xml ) ) { #namespace function call
   $this->xmlString = TidySpace::tidy_repair_string( $xml );


One would hope that when namespaces are ubiquitous there will be no need 
to prefix functions with package identifiers.


surely that would defeat the point of namespaces.. if the function 
exists in two or more namespaces/packages then namespace prefix is required.

with NAMESPACE {

}
syntax would be cool as well




 }
   }

 }

}
?>

all purely a made up example; I'd be interested to here any comments 
or what your ideal language (/modified php) would look like.


I've never really thought about how I'd like a languages syntax to be, 
I've just accepted the way it is. Having said that I've built a couple 
of compilers in my time and for the most part they were a combination of 
C, C++ and Perl, much like PHP. So in that respect PHP is the one that 
clearly makes the most sense to me for procedural languages.


In terms of OO I've always liked the Objective-C way of doing things. It 
seems more natural than the C++ syntax.


-Stut



why not throw out your ideal/made up procedural php language syntax; 
would be interested to see how what I as an OO dev would prefer compares 
to what you as a procedural dev would prefer.


thanks for the reply - probably a wasted convo but an interesting one 
that may lead somewhere!


--
nathan ( [EMAIL PROTECTED] )
{
  Senior Web Developer
  php + java + flex + xmpp + xml + ecmascript
  web development edinburgh | http://kraya.co.uk/
}

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



Re: [PHP] for the sake of conversation - syntax

2008-09-30 Thread Stut

On 29 Sep 2008, at 12:47, Nathan Rixham wrote:
Last week I got to thinking about PHP vs other languages.. sparing  
the details this is what I decided I'd like my code to look like :)  
[what *I* /as an OO developer/ need(?want)]




Looks a lot like Java, not that that's a bad thing.


{


Completely agree that multiple namespaces per file should be allowed,  
and using curly brackets is the obvious syntax.



 import com.anotherdom.MysqlDbHandler as DbHandlerA;
 import com.somedom.DbHandler as DbHandlerB; # "as" makes this easier
 import com.mydom.thatpackage.RssParser; # we don't have to "as"


Would this then be available as RssParser:: or would you need to  
specify the full name.



 import net.php.pecl.Tidy into TidySpace; # "into namespace"
 import org.nicedom.alwaysusethese.*; # why not?


How does PHP work out where these "packages" are?


 public class MyClass # visibility on classes
 {
   private $dba:DbHandlerA = new DbHandlerA();
   private $dbb:DbHandlerB = new DbHandlerB();


Can't do this. This would require the compilation phase to execute  
code. This is what constructors were made for.


Personally I'd prefer the fairly standard "type varname" order rather  
than the "varname:type" you have here.



   protected $xmlString:String;

   public function __construct( String $xml ):void #return types


Here you've switched to the "type varname" order for the parameters  
and gone back to ":type" for the return value. Why not just "function  
x(type varname) type" ?



   {
 if( TidySpace::tidy_is_xml( $xml ) ) { #namespace function call
   $this->xmlString = TidySpace::tidy_repair_string( $xml );


One would hope that when namespaces are ubiquitous there will be no  
need to prefix functions with package identifiers.



 }
   }

 }

}
?>

all purely a made up example; I'd be interested to here any comments  
or what your ideal language (/modified php) would look like.


I've never really thought about how I'd like a languages syntax to be,  
I've just accepted the way it is. Having said that I've built a couple  
of compilers in my time and for the most part they were a combination  
of C, C++ and Perl, much like PHP. So in that respect PHP is the one  
that clearly makes the most sense to me for procedural languages.


In terms of OO I've always liked the Objective-C way of doing things.  
It seems more natural than the C++ syntax.


-Stut

--
http://stut.net/

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



Re: [PHP] for loop inside a switch

2007-08-31 Thread Robert Cummings
On Fri, 2007-08-31 at 15:56 -0700, Dan wrote:
> Sanjeev is right.  You're thinking about the problem backwards.  You're 
> trying to build a Switch inside a loop.  Remember, if you ever have to do 
> some operating multiple times you're using a forloop, then the thing that 
> you want to repeat(switch case) is INSIDE the for loop.

Not always true. Sometimes once you've made the switch it applies to all
members of a data array. In which case switching on every iteration is a
waste of processor since you can check a single time outside the loop.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] for loop inside a switch

2007-08-31 Thread Dan
Sanjeev is right.  You're thinking about the problem backwards.  You're 
trying to build a Switch inside a loop.  Remember, if you ever have to do 
some operating multiple times you're using a forloop, then the thing that 
you want to repeat(switch case) is INSIDE the for loop.


- Dan

""Sanjeev N"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

This will not work at all..
Instead of switch try with if condition as follows

for ($i=0; $i <21; $i++) {
if(faq$i == $q){
echo $faq1;
break;
}
}
Now it works..

You can write the code to display the result how you want.. but you cant
write the code to write a code :)

Cheers

Warm Regards,
Sanjeev
http://www.sanchanworld.com
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Hulf [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 16, 2007 3:11 PM
To: php-general@lists.php.net
Subject: [PHP] for loop inside a switch

Hi,

switch ($q) {

for ($i=0; $i <21; $i++) {
case 'faq$i':
   echo $faq1;
   break;
}
}


I just want to loop out a big long list of cases.

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


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



Re: [PHP] for/foreach speed

2007-08-26 Thread Richard Lynch
On Mon, August 20, 2007 11:50 am, Sascha Braun, CEO @ fit-o-matic wrote:
> could somebody please explain me, what loop construct is
> faster? The for, while or foreach.

If you are doing anything where the speed of for/while/foreach
matters, you shouldn't have done that in PHP in the first place, but
should have put it into a custom PHP extension. :-)


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] for/foreach speed

2007-08-20 Thread Sascha Braun, CEO @ fit-o-matic
Thank you very much. When we might have time for testing we can
wager :))

Am Montag, den 20.08.2007, 13:21 -0400 schrieb Robert Cummings:
> On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic
> wrote:
> > Hi people,
> > 
> > could somebody please explain me, what loop construct is
> > faster? The for, while or foreach.
> 
> I haven't bothered testing but I'd wager $5 that the following is the
> fastest loop:
> 
>  
> while( 1 )
> {
> }
> 
> ?>
> 
> Depending on bytecode creation though, the following might be just as
> fast:
> 
>  
> for( ;; )
> {
> }
> 
> ?>
> 
> Cheers,
> Rob.

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



Re: [PHP] for/foreach speed

2007-08-20 Thread Robert Cummings
On Mon, 2007-08-20 at 18:50 +0200, Sascha Braun, CEO @ fit-o-matic
wrote:
> Hi people,
> 
> could somebody please explain me, what loop construct is
> faster? The for, while or foreach.

I haven't bothered testing but I'd wager $5 that the following is the
fastest loop:



Depending on bytecode creation though, the following might be just as
fast:



Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



RE: [PHP] for loop inside a switch

2007-08-17 Thread Sanjeev N
This will not work at all..
Instead of switch try with if condition as follows

for ($i=0; $i <21; $i++) {
if(faq$i == $q){
echo $faq1;
break;
}
}
Now it works..

You can write the code to display the result how you want.. but you cant
write the code to write a code :)

Cheers

Warm Regards,
Sanjeev
http://www.sanchanworld.com
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Hulf [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 16, 2007 3:11 PM
To: php-general@lists.php.net
Subject: [PHP] for loop inside a switch

Hi,

switch ($q) {

for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
 }
}


I just want to loop out a big long list of cases.

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

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



Re: [PHP] for loop inside a switch

2007-08-16 Thread Jim Lucas

Hulf wrote:

Hi,

switch ($q) {

for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
 }
}


I just want to loop out a big long list of cases.


are the case's that you want to create with the loop going to be the only case 
statements in the switch?


--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] for loop inside a switch

2007-08-16 Thread Dimiter Ivanov
On 8/16/07, Hulf <[EMAIL PROTECTED]> wrote:
> Hi,
>
> switch ($q) {
>
> for ($i=0; $i <21; $i++) {
> case 'faq$i':
> echo $faq1;
> break;
>  }
> }
>
>
> I just want to loop out a big long list of cases.

Maybe you want this kind of functionality :
http://www.php.net/manual/en/language.variables.variable.php

$faq="faq$q";
echo $$faq;

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



Re: [PHP] for loop inside a switch

2007-08-16 Thread Stut

Hulf wrote:

Hi,

switch ($q) {

for ($i=0; $i <21; $i++) {
case 'faq$i':
echo $faq1;
break;
 }
}


I just want to loop out a big long list of cases.


That's not a valid construct, but if I understand what you're trying do, 
this should work...


$faqs = array();
for ($i = 0; $i < 21; $i++)
$faqs[] = 'faq'.$i;
if (in_array($q, $faqs))
echo $faq1;

-Stut

--
http://stut.net/

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



Re: [PHP] for loop inside a switch

2007-08-16 Thread Mohamed Yusuf
I don't think it is going to work. IMO

On 8/16/07, Hulf <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> switch ($q) {
>
> for ($i=0; $i <21; $i++) {
> case 'faq$i':
> echo $faq1;
> break;
> }
> }
>
>
> I just want to loop out a big long list of cases.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] For Loop

2006-06-20 Thread D. Dante Lorenso

Albert Padley wrote:
Thanks everyone. Always nice to know there is more than one direction 
to go in.


A alternative to variable variables might use these:

   http://us3.php.net/manual/en/function.compact.php
   http://us3.php.net/manual/en/function.extract.php

'extract' looks like it might be right up your alley:

   

Dante



On Tuesday 20 June 2006 15:14, Albert Padley wrote:

I have a regular for loop - for($i=1; $i<100; $i++)

Within the loop I need to create variables named:

$p1name;
$p2name;
$p3name;
etc.

The integer portion of each variable name needs to be the value of 
$i.


I can't seem to get my syntax correct?

Can someone point me in the right direction?

Thanks.

Albert Padley


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



Re: [PHP] For Loop

2006-06-20 Thread Robert Cummings
On Tue, 2006-06-20 at 19:19, Albert Padley wrote:
> Thanks everyone. Always nice to know there is more than one direction  
> to go in.
> 
> Albert
> 
> 
> On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote:
> 
> > On Tuesday 20 June 2006 15:28, Adam Zey wrote:
> >> Ray Hauge wrote:
> >>> On Tuesday 20 June 2006 15:14, Albert Padley wrote:
>  I have a regular for loop - for($i=1; $i<100; $i++)
> 
>  Within the loop I need to create variables named:
> 
>  $p1name;
>  $p2name;
>  $p3name;
>  etc.
> 
>  The integer portion of each variable name needs to be the value  
>  of $i.
> 
>  I can't seem to get my syntax correct?
> 
>  Can someone point me in the right direction?
> 
>  Thanks.
> 
>  Albert Padley
> >>>
> >>> If you really want to keep the p?name syntax, I would suggest  
> >>> throwing
> >>> them in an array with keys.
> >>>
> >>> $arr["p1name"]
> >>> $arr["p2name"]
> >>>
> >>> Then that way you can create the key dynamically:
> >>>
> >>> $arr["p".$i."name"]
> >>>
> >>> Not pretty, but it works.
> >>>
> >>> Thanks,
> >>
> >> I haven't checked this, but couldn't you reference it as $arr["p 
> >> $iname"]
> >> ? Is there a reason why variable expansion wouldn't work in this
> >> circumstance?
> >>
> >> If it does, you could make it easier to read by doing $arr["p{$i} 
> >> name"]
> >> even though the {} aren't required. It'd be a lot easier to read than
> >> concatenations :)
> >>
> >> Regards, Adam.
> >
> > Both of those ways work.  I think there's a question on the PHP  
> > Certification
> > Exam about the different ways to work with strings.

Ahhh, got to love the fact that there's a question, yet no need for the
taker to actually understand the implications. Does anyone know if you
can get toilet paper with certs printed on it?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] For Loop

2006-06-20 Thread Albert Padley
Thanks everyone. Always nice to know there is more than one direction  
to go in.


Albert


On Jun 20, 2006, at 4:52 PM, Ray Hauge wrote:


On Tuesday 20 June 2006 15:28, Adam Zey wrote:

Ray Hauge wrote:

On Tuesday 20 June 2006 15:14, Albert Padley wrote:

I have a regular for loop - for($i=1; $i<100; $i++)

Within the loop I need to create variables named:

$p1name;
$p2name;
$p3name;
etc.

The integer portion of each variable name needs to be the value  
of $i.


I can't seem to get my syntax correct?

Can someone point me in the right direction?

Thanks.

Albert Padley


If you really want to keep the p?name syntax, I would suggest  
throwing

them in an array with keys.

$arr["p1name"]
$arr["p2name"]

Then that way you can create the key dynamically:

$arr["p".$i."name"]

Not pretty, but it works.

Thanks,


I haven't checked this, but couldn't you reference it as $arr["p 
$iname"]

? Is there a reason why variable expansion wouldn't work in this
circumstance?

If it does, you could make it easier to read by doing $arr["p{$i} 
name"]

even though the {} aren't required. It'd be a lot easier to read than
concatenations :)

Regards, Adam.


Both of those ways work.  I think there's a question on the PHP  
Certification

Exam about the different ways to work with strings.

--
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



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



Re: [PHP] For Loop

2006-06-20 Thread Ray Hauge
On Tuesday 20 June 2006 15:28, Adam Zey wrote:
> Ray Hauge wrote:
> > On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> >> I have a regular for loop - for($i=1; $i<100; $i++)
> >>
> >> Within the loop I need to create variables named:
> >>
> >> $p1name;
> >> $p2name;
> >> $p3name;
> >> etc.
> >>
> >> The integer portion of each variable name needs to be the value of $i.
> >>
> >> I can't seem to get my syntax correct?
> >>
> >> Can someone point me in the right direction?
> >>
> >> Thanks.
> >>
> >> Albert Padley
> >
> > If you really want to keep the p?name syntax, I would suggest throwing
> > them in an array with keys.
> >
> > $arr["p1name"]
> > $arr["p2name"]
> >
> > Then that way you can create the key dynamically:
> >
> > $arr["p".$i."name"]
> >
> > Not pretty, but it works.
> >
> > Thanks,
>
> I haven't checked this, but couldn't you reference it as $arr["p$iname"]
> ? Is there a reason why variable expansion wouldn't work in this
> circumstance?
>
> If it does, you could make it easier to read by doing $arr["p{$i}name"]
> even though the {} aren't required. It'd be a lot easier to read than
> concatenations :)
>
> Regards, Adam.

Both of those ways work.  I think there's a question on the PHP Certification 
Exam about the different ways to work with strings.

-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



Re: [PHP] For Loop

2006-06-20 Thread David Tulloh
Are you sure that you don't want an array?  Arrays are normally much
better for this type of thing.

That said,
${"p{$i}name"} = 'foo';


David

Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
> 
> Within the loop I need to create variables named:
> 
> $p1name;
> $p2name;
> $p3name;
> etc.
> 
> The integer portion of each variable name needs to be the value of $i.
> 
> I can't seem to get my syntax correct?
> 
> Can someone point me in the right direction?
> 
> Thanks.
> 
> Albert Padley
> 

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



Re: [PHP] For Loop

2006-06-20 Thread Adam Zey

Ray Hauge wrote:

On Tuesday 20 June 2006 15:14, Albert Padley wrote:

I have a regular for loop - for($i=1; $i<100; $i++)

Within the loop I need to create variables named:

$p1name;
$p2name;
$p3name;
etc.

The integer portion of each variable name needs to be the value of $i.

I can't seem to get my syntax correct?

Can someone point me in the right direction?

Thanks.

Albert Padley


If you really want to keep the p?name syntax, I would suggest throwing them in 
an array with keys.


$arr["p1name"]
$arr["p2name"]

Then that way you can create the key dynamically:

$arr["p".$i."name"]

Not pretty, but it works.

Thanks,


I haven't checked this, but couldn't you reference it as $arr["p$iname"] 
? Is there a reason why variable expansion wouldn't work in this 
circumstance?


If it does, you could make it easier to read by doing $arr["p{$i}name"] 
even though the {} aren't required. It'd be a lot easier to read than 
concatenations :)


Regards, Adam.

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



Re: [PHP] For Loop

2006-06-20 Thread Jeffrey Sambells

for($i=1; $i<100; $i++) {
${'p'.$i.'name'} = 'whatever';
}

- jeff

On 20-Jun-06, at 6:14 PM, Albert Padley wrote:


I have a regular for loop - for($i=1; $i<100; $i++)

Within the loop I need to create variables named:

$p1name;
$p2name;
$p3name;
etc.

The integer portion of each variable name needs to be the value of $i.

I can't seem to get my syntax correct?

Can someone point me in the right direction?

Thanks.

Albert Padley

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



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



Re: [PHP] For Loop

2006-06-20 Thread Ray Hauge
On Tuesday 20 June 2006 15:14, Albert Padley wrote:
> I have a regular for loop - for($i=1; $i<100; $i++)
>
> Within the loop I need to create variables named:
>
> $p1name;
> $p2name;
> $p3name;
> etc.
>
> The integer portion of each variable name needs to be the value of $i.
>
> I can't seem to get my syntax correct?
>
> Can someone point me in the right direction?
>
> Thanks.
>
> Albert Padley

If you really want to keep the p?name syntax, I would suggest throwing them in 
an array with keys.

$arr["p1name"]
$arr["p2name"]

Then that way you can create the key dynamically:

$arr["p".$i."name"]

Not pretty, but it works.

Thanks,
-- 
Ray Hauge
Programmer/Systems Administrator
American Student Loan Services
www.americanstudentloan.com
1.800.575.1099

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



[PHP] Re: PHP for Mac

2006-01-15 Thread David Hall

Richard Correia wrote:

Hi,

I want to install PHP5 on Mac powerbook G4. Can someone please let me know
where I can find it and it's related module?

I am mainly looking for GD and mingswf module on Mac.



http://www.phpmac.com/articles.php?view=244

very good instructions on compiling.
As shown in that tutorial (and works for me), just saying --with-gd in 
the configure options works well.  As for mngswf, I'd just recommend 
doing .\configure --help and seeing what that pops up for how to build 
mngswf in, but it should just be --with-ming, presuming you have 
installed mngswf from http://ming.sourceforge.net/ (which is a whole 
different world that I can't help you with.


But those directions gave me php 5 on my powerbook, so . . .

David Hall

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



Re: [PHP] For HomeSite users...

2005-01-20 Thread daniel
>
> .org don't work but www.phpeclipse.de does.
>

Sorry yeh , anyway it took me a while to change, but with all the added
plugins i now have a cooolIDE which does cvs, debugging, xml, html, xsl 
testing, db schema, db
modeller, uml, java, tomcat,team syncing, the list goes on. One thing i cant 
manage to do yet is
generate phpdocs aswell asimport project to cvs , still have to do that via 
command line :|

May get my hands dirty and build a phpdoc java plugin :)

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



Re: [PHP] For HomeSite users...

2005-01-20 Thread Danny Brow

.org don't work but www.phpeclipse.de does.

Dan.

On Fri, 2005-01-21 at 12:06 +1100, [EMAIL PROTECTED] wrote:
> I havent used Homesite in years, I am now an Eclipse advocate :)
> 
> www.phpeclipse.org :)
> 
> 
> > OMG!
> >
> > This is quite possibly the coolest thing I've found in a while, and it
> > breathes new life into my aging HomeSite+ v5.2 (now that Macromedia
> > isn't really updating it and is focusing more on their DreamWeaver
> > line).
> >
> > http://www.wilk4.com/asp4hs/installation.htm#parser
> >
> > http://www.wilk4.com/asp4hs/dnld/php5_parser_js.zip
> >
> > http://www.wilk4.com/asp4hs/list2.htm
> >
> > Just look around all those links and you will find an abundance of
> > useful toolbars, PHP5 color coders, snippets, context manuals, etc. I
> > nearly spooged on myself when I came across this today. (no pun
> > intended)
> >
> > "Jeremy Swinborne" <[EMAIL PROTECTED]> created a PHP5 color coding
> > .scc file that is just a life saver. It fixes many of the short comings
> > of the default PHP4 color coder. It handles stuff like:
> >
> > echo "\"this is embeded $variable in my output\""; and it knows about
> > classes!
> >
> >
> > daevid.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 

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



Re: [PHP] For HomeSite users...

2005-01-20 Thread daniel
I havent used Homesite in years, I am now an Eclipse advocate :)

www.phpeclipse.org :)


> OMG!
>
> This is quite possibly the coolest thing I've found in a while, and it
> breathes new life into my aging HomeSite+ v5.2 (now that Macromedia
> isn't really updating it and is focusing more on their DreamWeaver
> line).
>
> http://www.wilk4.com/asp4hs/installation.htm#parser
>
> http://www.wilk4.com/asp4hs/dnld/php5_parser_js.zip
>
> http://www.wilk4.com/asp4hs/list2.htm
>
> Just look around all those links and you will find an abundance of
> useful toolbars, PHP5 color coders, snippets, context manuals, etc. I
> nearly spooged on myself when I came across this today. (no pun
> intended)
>
> "Jeremy Swinborne" <[EMAIL PROTECTED]> created a PHP5 color coding
> .scc file that is just a life saver. It fixes many of the short comings
> of the default PHP4 color coder. It handles stuff like:
>
> echo "\"this is embeded $variable in my output\""; and it knows about
> classes!
>
>
> daevid.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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



Re: [PHP] For Loop

2004-12-08 Thread Travis Conway
try
for($i=0;$i>$months_arr_length;$i++)
look at it as this:
for(i as starting point; till i is what? greater than my length; increment i 
how? by 1) {

HTH
Trav
- Original Message - 
From: "R. Van Tassel" <[EMAIL PROTECTED]>
To: "'PHP general'" <[EMAIL PROTECTED]>
Sent: Wednesday, December 08, 2004 3:41 PM
Subject: [PHP] For Loop


I have a question about the following code:
**
$months_arr = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", 
"AUG",
"SEP", "OCT", "NOV", "DEC");
$months_arr_length = count($months_arr);

for($i = 0; $i = $months_arr_length; $i++){
echo $months_arr[1]." ";
}
***
When I run the code above it continues and never stops. According to the 
PHP
documentation the second condition works as follows:

"In the beginning of each iteration, expr2 is evaluated. If it evaluates 
to
TRUE, the loop continues and the nested statement(s) are executed. If it
evaluates to FALSE, the execution of the loop ends."

In the first iteration of the loop $i would equal 0 and the array length 
is
12. 12 is consistent. To it seems that the loop should STOP when the 
counter
reaches 12, equal to the length of the array. Why is it continuing in a
neverending loop? What am I missing?

Changing the condition of the for loop to $i <= $months_arr_length; fixes
everything and it works properly.
Can someone please explain where my confusion is?
Thanks,
~R. Van Tassel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] For Loop

2004-12-08 Thread hitek
$i = $months_arr_length is an assignment, not a comparison, so it will always 
evaluate to true, and you are setting your counter var to 12 every time the 
loop runs, that's why it runs infinitely.


> 
> From: "R. Van Tassel" <[EMAIL PROTECTED]>
> Date: 2004/12/08 Wed PM 04:41:00 EST
> To: "'PHP general'" <[EMAIL PROTECTED]>
> Subject: [PHP] For Loop
> 
> I have a question about the following code:
> 
> **
> 
> $months_arr = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG",
> "SEP", "OCT", "NOV", "DEC");
> $months_arr_length = count($months_arr);
> 
> for($i = 0; $i = $months_arr_length; $i++){
>   echo $months_arr[1]." ";
> }
> 
> ***
> 
> When I run the code above it continues and never stops. According to the PHP
> documentation the second condition works as follows:
> 
> "In the beginning of each iteration, expr2 is evaluated. If it evaluates to
> TRUE, the loop continues and the nested statement(s) are executed. If it
> evaluates to FALSE, the execution of the loop ends."
> 
> In the first iteration of the loop $i would equal 0 and the array length is
> 12. 12 is consistent. To it seems that the loop should STOP when the counter
> reaches 12, equal to the length of the array. Why is it continuing in a
> neverending loop? What am I missing?
> 
> Changing the condition of the for loop to $i <= $months_arr_length; fixes
> everything and it works properly.
> 
> Can someone please explain where my confusion is?
> 
> Thanks,
> ~R. Van Tassel
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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



Re: [PHP] For Loop

2004-12-08 Thread Gareth Williams
What happens is (if I understand it correctly):
First, PHP sets $i to equal 0, and then immediately sets $i to 
$months_arr_length.

Every time the loop executes, it resets $1 to $months_arr_length, so 
you are stuck in an infinite loop.

The reason behind this is you are using assignment equals (=) instead 
of comparison equals(==).  It's a mistake I've made myself quite a few 
times.

As an aside, a neater way of using a for loop on an array is the 
following:

foreach ($months_arr as $key => $value)
{
echo $value."";
}

On 8 Dec 2004, at 22:41, R. Van Tassel wrote:
I have a question about the following code:
**
$months_arr = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", 
"AUG",
"SEP", "OCT", "NOV", "DEC");
$months_arr_length = count($months_arr);

for($i = 0; $i = $months_arr_length; $i++){
echo $months_arr[1]." ";
}
***
When I run the code above it continues and never stops. According to 
the PHP
documentation the second condition works as follows:

"In the beginning of each iteration, expr2 is evaluated. If it 
evaluates to
TRUE, the loop continues and the nested statement(s) are executed. If 
it
evaluates to FALSE, the execution of the loop ends."

In the first iteration of the loop $i would equal 0 and the array 
length is
12. 12 is consistent. To it seems that the loop should STOP when the 
counter
reaches 12, equal to the length of the array. Why is it continuing in a
neverending loop? What am I missing?

Changing the condition of the for loop to $i <= $months_arr_length; 
fixes
everything and it works properly.

Can someone please explain where my confusion is?
Thanks,
~R. Van Tassel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] For how long session exist

2004-10-14 Thread Dan Joseph
> > For what period of time a session can exist? Or session exist as soon
> > as browser is open?
> 
> 1. For as long as the user is active
> 2. Depends on what page the browser opens

I'm gonna elaborate a bit...

In your php.ini there is a session idle timeout setting.  The
inactivity John mentioned is set there.  Otherwise, yes, as soon as
the browser is closed.

-Dan Joseph

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



Re: [PHP] For how long session exist

2004-10-14 Thread John Holmes
Jerry Swanson wrote:
For what period of time a session can exist? Or session exist as soon
as browser is open?
1. For as long as the user is active
2. Depends on what page the browser opens
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] for loops performance

2004-08-21 Thread John Holmes
Xongoo!com: Central unit wrote:
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages, it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
If you only generate 100s of pages, it'll probably load about ten times 
faster...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] for loops performance

2004-08-21 Thread Shawn McKenzie
Xongoo!Com: Central Unit wrote:
Here's:
for ($c=1; $c<$numpages; $c++){
echo "$c | ";
}
When it generates 1-10, it is normal 0.05 s, but
often I need more than 1000, so when generating
100's - it is 0.5-1.5 sec., when more than 1000 -
10+ s.

I am thinking on running sopme sort of:
1) generate code of number of pages once a day
using cron,
2) store it in database,
3) show static generated code from database.
But before doing it I've thought to ask here.
--
Tadas Talaikis
[EMAIL PROTECTED]
http://www.xongoo.com
- Original Message -
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Xongoo!com: Central unit" <[EMAIL PROTECTED]>
Cc: "PHP-General" <[EMAIL PROTECTED]>
Sent: Saturday, August 21, 2004 7:32 PM
Subject: Re: [PHP] for loops performance

On Sat, 2004-08-21 at 12:17, Xongoo!com: Central
unit wrote:
Holla,
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages,
it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
Give us an example of your for loop that is
having efficiency problems.
Cheers,
Rob.
You can do this once and instead of echoing the links, save then in a 
session var and use that on subsequent pages.

Maybe on first page or before in some other script:
session_start();
for ($c=1; $c<$numpages; $c++){
$_SESSION['links'] .= "$c | ";
}
Then on other pages:
session_start();
echo $_SESSION['links'];
-Shawn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] for loops performance

2004-08-21 Thread Xongoo!com: Central unit
Here's:

for ($c=1; $c<$numpages; $c++){
echo "$c | ";
}

When it generates 1-10, it is normal 0.05 s, but
often I need more than 1000, so when generating
100's - it is 0.5-1.5 sec., when more than 1000 -
> 10+ s.

I am thinking on running sopme sort of:
1) generate code of number of pages once a day
using cron,
2) store it in database,
3) show static generated code from database.

But before doing it I've thought to ask here.

--
Tadas Talaikis
[EMAIL PROTECTED]
http://www.xongoo.com

- Original Message -
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Xongoo!com: Central unit" <[EMAIL PROTECTED]>
Cc: "PHP-General" <[EMAIL PROTECTED]>
Sent: Saturday, August 21, 2004 7:32 PM
Subject: Re: [PHP] for loops performance


> On Sat, 2004-08-21 at 12:17, Xongoo!com: Central
unit wrote:
> > Holla,
> >
> > Maybe someone knows how to improve for loops
> > performance? When generating 1000's of pages,
it
> > oads in 10-20 seconds. Maybe there is some
> > solution I don't know about?
>
> Give us an example of your for loop that is
having efficiency problems.
>
> Cheers,
> Rob.

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



Re: [PHP] for loops performance

2004-08-21 Thread raditha dissanayake
Xongoo!com: Central unit wrote:
Holla,
Maybe someone knows how to improve for loops
performance? When generating 1000's of pages, it
oads in 10-20 seconds. Maybe there is some
solution I don't know about?
 

prey what is your algorithm?
Thanks!
--
Tadas Talaikis
[EMAIL PROTECTED]
http://www.xongoo.com
 


--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] for loops performance

2004-08-21 Thread Robert Cummings
On Sat, 2004-08-21 at 12:17, Xongoo!com: Central unit wrote:
> Holla,
> 
> Maybe someone knows how to improve for loops
> performance? When generating 1000's of pages, it
> oads in 10-20 seconds. Maybe there is some
> solution I don't know about?

Give us an example of your for loop that is having efficiency problems.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] For Loop Problems

2004-07-28 Thread Jason Barnett
[EMAIL PROTECTED] wrote:
Hello Everyone,
I'm building a hotel management system and I can't seem to figure out why my
for() loop doesn't work the way it should. I'm using patTemplate to create
the HTML Template (I like using it and I don't want to start a pro/con
template war). Here is the script:
for ($j = 0; $j < 32; $j++) {
for ($i = 0; $i < count($num_days); $i++) {
$template->addVar("room_num", "ROOM_NUM", '101');
$template->addVar("room_type", "ROOM_TYPE", 'NQQ');
$template->addVar("guest_NameRate", "GUEST_NAME", 'NAVID YAR');
$template->addVar("guest_NameRate", "GUEST_ID", 'fname');
$template->addVar("guest_NameRate", "CLASS_GUEST", 'fname');
$template->addVar("guest_NameRate", "ROOM_RATE", '49.95');
$template->parseTemplate("guest_NameRate", "a");
}
I'm not aware of what patTemplate does, but my guess is that when you addVar() 
each time it is just pushing each variable into an array.  In other words, you 
keep adding 7 elements onto the end of an array WITHOUT removing old elements. 
There is probably a removeVar method or something similar to help you with this. 
 If not, then you probably need to have a different template variable for each 
row and then populate those template variables with 1 week's data.

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


Re: [PHP] For Loop Problems

2004-07-28 Thread rush
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> for ($j = 0; $j < 32; $j++) {
> for ($i = 0; $i < count($num_days); $i++) {
> $template->addVar("room_num", "ROOM_NUM", '101');
> $template->addVar("room_type", "ROOM_TYPE", 'NQQ');
> $template->addVar("guest_NameRate", "GUEST_NAME", 'NAVID YAR');
> $template->addVar("guest_NameRate", "GUEST_ID", 'fname');
> $template->addVar("guest_NameRate", "CLASS_GUEST", 'fname');
> $template->addVar("guest_NameRate", "ROOM_RATE", '49.95');
> $template->parseTemplate("guest_NameRate", "a");
> }
> $template->parseTemplate("guest_row", "a");
> }
>
> This inner for() loop works great. It creates a SINGLE row with 7 columns
of
> data (one column for each day of the week). However, the outer for() loop
> does not work like it should. I want it to display 32 rows of 7 columns
per
> row. But what happens is that on every row after the first row it appends
7
> more columns at the end of each row. So row 2 will have 14 columns, row 3
> will have 21 columns, row 4 will have 28 columns, and so on. I can't
figure
> out why this is. Either it's something new in PHP5 or I'm doing something
> really stupid. I am sending a PDF attachment of a snapshot showing a hint,
> made purely with HTML, of what I am trying to achieve. If anyone can help
me
> it would be greatly appreciated. Thanks guys.

I seriously doubt that php has problems to execute for loop correctly, you
are probably missusing your template system. Say what does "a" stand for in:

  $template->parseTemplate("guest_NameRate", "a");

if it stands for append, than maybe in second pass through the loop you add
7 fiends to allready existing 7, in 3. pass you add 7 more to 14 existing,
etc..

rush
--
http://www.templatetamer.com/

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



Re: [PHP] For/Next Help Needed

2004-07-04 Thread John W. Holmes
for($z=0;$zWhat is the difference between this code and using a "foreach" command?
Nothing, really. Using a foreach() simply means you don't have to keep 
up with the $z count variable...

foreach($recipient as $email)
{ mail($email,$subject,$message,$headers); }
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] For/Next Help Needed

2004-07-04 Thread mcp6453
John W. Holmes wrote:
> 
> mcp6453 wrote:
> 
> > I'm using Jack's PHP FormMail script, and I need to change it. I know
> > very little abou PHP, but here's what I very much need to do right away.
> >
> > I need the script to send the same hard coded message to each of 10
> > people. All of the email addresses do not need to be in the "To" field.
> > Only the intended recipient needs to be there.
> >
> > So, I see the code as something line this:
> >
> > $recipient[1] = "[EMAIL PROTECTED]";
> > $recipient[2] = "[EMAIL PROTECTED]";
> > ...
> > $recipient[n] = "[EMAIL PROTECTED]";
> >
> > Then, something like this:
> >
> > for ($z=0;$z >   mail($recipient[z$], $subject, $message, $headers);
> 
> for($z=0;$z { mail($recipient[$z],$subject,$message,$headers); }


Thanks, John. That's helpful. I'm not sure what other problems I'm going
to run into. It looks like I may have to put the whole script inside the
"for" loop.

What is the difference between this code and using a "foreach" command?

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



Re: [PHP] For/Next Help Needed

2004-07-04 Thread John W. Holmes
mcp6453 wrote:
I'm using Jack's PHP FormMail script, and I need to change it. I know
very little abou PHP, but here's what I very much need to do right away.
I need the script to send the same hard coded message to each of 10
people. All of the email addresses do not need to be in the "To" field.
Only the intended recipient needs to be there.
So, I see the code as something line this:
$recipient[1] = "[EMAIL PROTECTED]";
$recipient[2] = "[EMAIL PROTECTED]";
...
$recipient[n] = "[EMAIL PROTECTED]";
Then, something like this:
for ($z=0;$zfor($z=0;$z
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] For your reference, how to validate dynamic form fields.

2004-04-06 Thread holmes072000
> From: "Hawkes, Richard" <[EMAIL PROTECTED]>
> 
> Just spent far too long trying to figure out how to do this, so I thought I'd
> pass it on to you great guys, in case you need it for the future.
>  
> I used PHP to create multiple form rows, each one numbered:
> 
>  for ($i =1; $i <= 20; $i++) {
> echo("");
> }
> ?>

Use arrays. It'll make your life easier.

echo "");

You can still reference the element in Javascript, just "by name" or whatever you call 
it. 

form.element['userId[1]'] (or something like that).

You show a Javascript validation. Remember that this is easily bypassed so you also 
need to validate the numbers on the PHP side. 



---John Holmes...

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



Re: [PHP] for statement weirdness, no echo

2003-12-09 Thread Richard Davey
Hello Jay,

Tuesday, December 9, 2003, 1:31:35 PM, you wrote:

JB> for($i = 2; $i < 0144; $i++){
JB> echo $i . "\n";
JB> }

JB> does not echo anything. Even put the numbers in quotes (single and
JB> double). What has being brain-dead caused me to miss this morning?

Look at your values being compared :)

-- 
Best regards,
 Richardmailto:[EMAIL PROTECTED]

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



RE: [PHP] for statement weirdness, no echo SOLVED

2003-12-09 Thread Jay Blanchard
[snip]
for($i = 2; $i < 0144; $i++){
echo $i . "\n";
}

does not echo anything. Even put the numbers in quotes (single and
double). What has being brain-dead caused me to miss this morning?
[/snip]

I found it...one too many zeros in initial $i (I wanted to say "one two
many..") :)

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



Re: [PHP] for help :how to detect norton client through php socket

2003-12-04 Thread David Otton
On Thu, 4 Dec 2003 15:39:30 +0800, you wrote:

>how can i detect whether norton antivirus client  are installed on the hosts
>through php socket ?

Why would you want to?

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



Re: [PHP] for loop break and continue

2003-09-27 Thread Becoming Digital
> Can't you let me have a shred of programming self-respect?
> 
> Rich (I should have cracked the book) Fox

Get out!  No soup (or respect) for you! ;)

Edward Dudlik
Becoming Digital
www.becomingdigital.com



- Original Message - 
From: "Rich Fox" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, 25 September, 2003 12:26
Subject: Re: [PHP] for loop break and continue


Can't you let me have a shred of programming self-respect?

Rich (I should have cracked the book) Fox

> On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
> > DOH!
> >
> > This is a new addition to PHP because it wasn't there before!
> >
> > Thanks for the slap.
>
> PHP has supported break for as long as I can remember which goes back to
> about 1999 and PHP 3.something.
>
> Cheers,
> Rob.
>
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

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

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



RE: [PHP] for loop break and continue

2003-09-25 Thread Jay Blanchard
[snip]
Can't you let me have a shred of programming self-respect?

Rich (I should have cracked the book) Fox
[/snip]

Nah, too easy! :) We all get bumped from time to time

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



Re: [PHP] for loop break and continue

2003-09-25 Thread Rich Fox
Can't you let me have a shred of programming self-respect?

Rich (I should have cracked the book) Fox

> On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
> > DOH!
> >
> > This is a new addition to PHP because it wasn't there before!
> >
> > Thanks for the slap.
>
> PHP has supported break for as long as I can remember which goes back to
> about 1999 and PHP 3.something.
>
> Cheers,
> Rob.
>
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

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



Re: [PHP] for loop break and continue

2003-09-25 Thread Robert Cummings
On Thu, 2003-09-25 at 12:04, Rich Fox wrote:
> DOH!
> 
> This is a new addition to PHP because it wasn't there before!
> 
> Thanks for the slap.

PHP has supported break for as long as I can remember which goes back to
about 1999 and PHP 3.something.

Cheers,
Rob.

-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] for loop break and continue

2003-09-25 Thread Rich Fox
DOH!

This is a new addition to PHP because it wasn't there before!

Thanks for the slap.


"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Take the sample code below, paste it to a PHP file, add a real
> conditional, execute script. Voila, you've taken the first step towards
> helping yourself.
>
> Cheers,
> Rob.
>
>
> On Thu, 2003-09-25 at 11:42, Rich Fox wrote:
> > Hi,
> > Is there an equivalent to the C++ 'break' command to stop execution of a
for
> > loop? I know I can use 'goto' but I don't want to unless I have to.
> >
> > for ($i=0; $i<$n; $i++)
> > if (some condition)
> > break;
> >
> > And, what about 'continue' which skips the rest of the code in the for
loop
> > and immediately goes on to the next iteration?
> >
> > Thanks,
> >
> > Rich
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'

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



Re: [PHP] for loop break and continue

2003-09-25 Thread Robert Cummings
Take the sample code below, paste it to a PHP file, add a real
conditional, execute script. Voila, you've taken the first step towards
helping yourself.

Cheers,
Rob.


On Thu, 2003-09-25 at 11:42, Rich Fox wrote:
> Hi,
> Is there an equivalent to the C++ 'break' command to stop execution of a for
> loop? I know I can use 'goto' but I don't want to unless I have to.
> 
> for ($i=0; $i<$n; $i++)
> if (some condition)
> break;
> 
> And, what about 'continue' which skips the rest of the code in the for loop
> and immediately goes on to the next iteration?
> 
> Thanks,
> 
> Rich
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] For Loops and Variables??

2003-09-16 Thread Chris W. Parker
Chris W. Parker <>
on Tuesday, September 16, 2003 4:07 PM said:

> This Is Good(tm):
> 
> for($x=0;$x<100;$x++)
> {
>   for($x=0;$x<100;$x++)
>   {
>   echo "Me happy now!!";
>   }
> }

Hehe... whoops! Should be:

for($x=0;$x<100;$x++)
{
for($y=0;$y<100;$y++)
{
echo "Me happy now!!";
}
}



BYE!

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



RE: [PHP] For Loops and Variables??

2003-09-16 Thread Chris W. Parker
John Ryan 
on Saturday, September 13, 2003 9:26 AM said:

> When I use for loops, at the start of each iteration, the variables
> hold the values from the last loop.

You're doing it wrong then (I think).

1. You should always initialize your loop counters.

i.e.

$x = 0;

while($x < 100)
{
$x++;
}

2. Don't use the same counter name in all your loops.

This is bad:

for($x=0;$x<100;$x++)
{
for($x=0;$x<100;$x++)
{
echo "i'm going to go on forever!!";
}
}

This Is Good(tm):

for($x=0;$x<100;$x++)
{
for($x=0;$x<100;$x++)
{
echo "Me happy now!!";
}
}



Does that help?

Chris.

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



Re: [PHP] For Loops and Variables??

2003-09-13 Thread Curt Zirzow
* Thus wrote John Ryan ([EMAIL PROTECTED]):
> When I use for loops, at the start of each iteration, the variables hold the
> values from the last loop.
> 
> First, is there an elegant way of clearing variables at the start of each
> loop rather than using unset???! It just seems wrong.

I'm unclear as to what elegant implies.

> 
> Also, all my problems would be solved if variables in a for loop were kept
> local, but everything by default is a global. Can I change this in php.ini
> or something??

no, there are only two scopes in php, it is either GLOBAL or local inside
a function/class.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



RE: [PHP] for loop and FTP

2003-08-14 Thread Jay Blanchard
[snip]
I need to grab five pages from a web site every day and then FTP those
pages
to another site.

I was wondering if I should grab all five pages (and store them
somewhere)
and then FTP all five.
[/snip]

This sounds like the more prudent move as it is more efficient. You can
also confirm that you have received all five before establishing any FTP
connection (if it would be invalid to FTP less than the full set). 

HTH

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



Re: [PHP] for the love of god, remove me

2003-08-09 Thread David Robley
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> > It's not usless if you read the page. 
> > [EMAIL PROTECTED]
> 
> As I said, the page is useless. This doesn't work either.
> 
> J.
> 

You may be trying to unsubscribe from a different email address that the 
one used originally to subscribe. The original subscribe confirmation, if 
you kept it, should have the address in it. Failing that, have a look at 
the headers of any message from the list for a clue as to the subscribed 
address. I'd be more specific, but I read from the newsgroup so don't have 
an appropriate set of headers available to refer to.

-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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



Re: [PHP] for the love of god, remove me

2003-08-07 Thread Joseph Bannon
> It's not usless if you read the page. 
> [EMAIL PROTECTED]

As I said, the page is useless. This doesn't work either.

J.



> On Sun, 2003-08-03 at 13:45, Joseph Bannon wrote:
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> > This page is useless, you can't remove yourself.
> > 
> > J. 
> > 
> > 
> > __
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > http://sitebuilder.yahoo.com
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



Re: [PHP] for the love of god, remove me

2003-08-03 Thread Curt Zirzow
* Thus wrote Joseph Bannon ([EMAIL PROTECTED]):
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> This page is useless, you can't remove yourself.

Internet technology hasn't gotten far enough to read the minds of
users.

If maybe you actually read the page you might have figured out that
it tells how to unsubscribe to the list, several different ways if
i might add.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

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



Re: [PHP] for the love of god, remove me

2003-08-03 Thread David Smith
It's not usless if you read the page. 
[EMAIL PROTECTED]
On Sun, 2003-08-03 at 13:45, Joseph Bannon wrote:
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> This page is useless, you can't remove yourself.
> 
> J. 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com


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



RE: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Daevid Vincent
> From: Kjartan Mannes [mailto:kjartan@;zind.net] 
> 
> Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> > $max = max($myArray);
> > for( $x = 1; $x <= $length; $x++ ) {}
> 
> >  -- OR --
> 
> > for( $x = 1; $x <= max($myArray); $x++ ) {}
> 
> > My gut instinct tells me since PHP is interpreted, that the 
> top one is 
> > the better way to go, but with the Zend Optimizer, I don't 
> know if PHP handles them the same way or not?
> 
> The first one is faster, but it depends on the site of the 
> array and how often you call the loop. I prefer doing it like 
> this though:
> 
>  for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}

Just a little point-out that I used max() not count() because I need to
loop on the *largest value* in the array, not how many *elements* are
actually in the array. But the logic is still sound, and it is true that
calling a function is sub-optimal it seems, even though my array doesn't
change in any way when the for loop is called. PHP still calls the max()
or count() function each time anyways. So alas, I have to create another
variable that serves one single purpose and has a very finite lifespan.
;-)

> For some good optimization (and other) tips check out:
>   http://phplens.com/lens/php-book/optimizing-debugging-php.php
>   http://www.lerdorf.com/tips.pdf

Thanx for the pointers. I'll check 'em out.

d


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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread .: B i g D o g :.
Sorry bro,

was thinking that in the initialization section that it would run the
count again, but that is not the case...

$max is initialized first and never looked at again during the for
loop...



On Fri, 2002-11-08 at 19:00, Marek Kilimajer wrote:
> If you reed the code carefully, it first assigns $x=1 and 
> $max=count($myArray),
> then it compares $x with $max
> 
> 
> .: B i g D o g :. wrote:
> 
> >Then only problem with doing it like
> >
> >for($x = 1, $max = count($myArray); $x <= $max; $x++ )
> >
> >is that the $max = count( $myArray ) is always verified in each
> >loop...slowing the for loop down...
> >
> >faster to do
> >$max = count( $myArray );
> >for( $x = 1, $x <= $max; $x++ )
> >
> >
> >just my $0.02...for the day...
> >
> >
> >
> >On Fri, 2002-11-08 at 15:57, Kjartan Mannes wrote:
> >  
> >
> >>Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> >>
> >>
> >>>$max = max($myArray);
> >>>for( $x = 1; $x <= $length; $x++ ) {}
> >>>  
> >>>
> >>> -- OR --
> >>>  
> >>>
> >>>for( $x = 1; $x <= max($myArray); $x++ ) {}
> >>>  
> >>>
> >>>My gut instinct tells me since PHP is interpreted, that the top one is
> >>>the better way to go, but with the Zend Optimizer, I don't know if PHP
> >>>handles them the same way or not?
> >>>  
> >>>
> >>The first one is faster, but it depends on the site of the array and how
> >>often you call the loop. I prefer doing it like this though:
> >>
> >> for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
> >>
> >>For some good optimization (and other) tips check out:
> >>  http://phplens.com/lens/php-book/optimizing-debugging-php.php
> >>  http://www.lerdorf.com/tips.pdf
> >>
> >>-- 
> >>Kjartan <[EMAIL PROTECTED]> (http://natrak.net/)
> >>:: "Silence is one great art of conversation."
> >>
> >>
> >>-- 
> >>PHP General Mailing List (http://www.php.net/)
> >>To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
.: B i g D o g :.



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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Marek Kilimajer
If you reed the code carefully, it first assigns $x=1 and 
$max=count($myArray),
then it compares $x with $max


.: B i g D o g :. wrote:

Then only problem with doing it like

for($x = 1, $max = count($myArray); $x <= $max; $x++ )

is that the $max = count( $myArray ) is always verified in each
loop...slowing the for loop down...

faster to do
$max = count( $myArray );
for( $x = 1, $x <= $max; $x++ )


just my $0.02...for the day...



On Fri, 2002-11-08 at 15:57, Kjartan Mannes wrote:
 

Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
   

$max = max($myArray);
for( $x = 1; $x <= $length; $x++ ) {}
 

-- OR --
 

for( $x = 1; $x <= max($myArray); $x++ ) {}
 

My gut instinct tells me since PHP is interpreted, that the top one is
the better way to go, but with the Zend Optimizer, I don't know if PHP
handles them the same way or not?
 

The first one is faster, but it depends on the site of the array and how
often you call the loop. I prefer doing it like this though:

for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}

For some good optimization (and other) tips check out:
 http://phplens.com/lens/php-book/optimizing-debugging-php.php
 http://www.lerdorf.com/tips.pdf

--
Kjartan <[EMAIL PROTECTED]> (http://natrak.net/)
:: "Silence is one great art of conversation."


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



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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread .: B i g D o g :.
Then only problem with doing it like

for($x = 1, $max = count($myArray); $x <= $max; $x++ )

is that the $max = count( $myArray ) is always verified in each
loop...slowing the for loop down...

faster to do
$max = count( $myArray );
for( $x = 1, $x <= $max; $x++ )


just my $0.02...for the day...



On Fri, 2002-11-08 at 15:57, Kjartan Mannes wrote:
> Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> > $max = max($myArray);
> > for( $x = 1; $x <= $length; $x++ ) {}
> 
> >  -- OR --
> 
> > for( $x = 1; $x <= max($myArray); $x++ ) {}
> 
> > My gut instinct tells me since PHP is interpreted, that the top one is
> > the better way to go, but with the Zend Optimizer, I don't know if PHP
> > handles them the same way or not?
> 
> The first one is faster, but it depends on the site of the array and how
> often you call the loop. I prefer doing it like this though:
> 
>  for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
> 
> For some good optimization (and other) tips check out:
>   http://phplens.com/lens/php-book/optimizing-debugging-php.php
>   http://www.lerdorf.com/tips.pdf
> 
> -- 
> Kjartan <[EMAIL PROTECTED]> (http://natrak.net/)
> :: "Silence is one great art of conversation."
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
.: B i g D o g :.



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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Maxim Maletsky

the most correct way is probably:

$size = sizeof($myArray);
for( $x = 1; $x <= $size; $x++ ) {}

But, this is too personal and is "my way".

--
Maxim Maletsky
[EMAIL PROTECTED]



Kjartan Mannes <[EMAIL PROTECTED]> wrote... :

> Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> > $max = max($myArray);
> > for( $x = 1; $x <= $length; $x++ ) {}
> 
> >  -- OR --
> 
> > for( $x = 1; $x <= max($myArray); $x++ ) {}
> 
> > My gut instinct tells me since PHP is interpreted, that the top one is
> > the better way to go, but with the Zend Optimizer, I don't know if PHP
> > handles them the same way or not?
> 
> The first one is faster, but it depends on the site of the array and how
> often you call the loop. I prefer doing it like this though:
> 
>  for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}
> 
> For some good optimization (and other) tips check out:
>   http://phplens.com/lens/php-book/optimizing-debugging-php.php
>   http://www.lerdorf.com/tips.pdf
> 
> -- 
> Kjartan <[EMAIL PROTECTED]> (http://natrak.net/)
> :: "Silence is one great art of conversation."
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Kjartan Mannes
Friday, November 8, 2002, 12:13:01 PM, Daevid Vincent wrote:
> $max = max($myArray);
> for( $x = 1; $x <= $length; $x++ ) {}

>  -- OR --

> for( $x = 1; $x <= max($myArray); $x++ ) {}

> My gut instinct tells me since PHP is interpreted, that the top one is
> the better way to go, but with the Zend Optimizer, I don't know if PHP
> handles them the same way or not?

The first one is faster, but it depends on the site of the array and how
often you call the loop. I prefer doing it like this though:

 for($x = 1, $max = count($myArray); $x <= $max; $x++ ) {}

For some good optimization (and other) tips check out:
  http://phplens.com/lens/php-book/optimizing-debugging-php.php
  http://www.lerdorf.com/tips.pdf

-- 
Kjartan <[EMAIL PROTECTED]> (http://natrak.net/)
:: "Silence is one great art of conversation."


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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Maxim Maletsky
The first one is better, and, besides that - it is the most correct way
- there might be something making the array change while inside the loop
- thus you have to do some extremely high calculations to understand the
array does not change runtime, which makes it useless.

Simply do the "elegant programming" and you will never have these issues. 


--
Maxim Maletsky
[EMAIL PROTECTED]



"Ford, Mike   [LSS]" <[EMAIL PROTECTED]> wrote... :

> > -Original Message-
> > From: Daevid Vincent [mailto:daevid@;daevid.com]
> > Sent: 08 November 2002 11:13
> > 
> > Is PHP smart enough to optimize loops?
> > 
> > That is, are these two 'for...loops' equivalent or is one slower than
> > the other?
> > 
> > $max = max($myArray);
> > for( $x = 1; $x <= $length; $x++ ) {}
> > 
> >  -- OR --
> > 
> > for( $x = 1; $x <= max($myArray); $x++ ) {}
> > 
> > My gut instinct tells me since PHP is interpreted, that the top one is
> > the better way to go, but with the Zend Optimizer, I don't know if PHP
> > handles them the same way or not?
> 
> With bare PHP, yes the first one is quicker.  Don't know if the Zend Optimiser 
>changes that.
> 
> Cheers!
> 
> Mike
> 
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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




Re: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Marek Kilimajer
As max($myArray) may potentionaly change, it is evalueted everytime (you 
may do
$myArray[]=$big_number in your loop). So if you know it is not going to 
change, use the first way.

Daevid Vincent wrote:

Is PHP smart enough to optimize loops?

That is, are these two 'for...loops' equivalent or is one slower than
the other?

$max = max($myArray);
for( $x = 1; $x <= $length; $x++ ) {}

-- OR --

for( $x = 1; $x <= max($myArray); $x++ ) {}

My gut instinct tells me since PHP is interpreted, that the top one is
the better way to go, but with the Zend Optimizer, I don't know if PHP
handles them the same way or not?


 



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




RE: [PHP] For ... <= max($myArray) vs For ... <= $max

2002-11-08 Thread Ford, Mike [LSS]
> -Original Message-
> From: Daevid Vincent [mailto:daevid@;daevid.com]
> Sent: 08 November 2002 11:13
> 
> Is PHP smart enough to optimize loops?
> 
> That is, are these two 'for...loops' equivalent or is one slower than
> the other?
> 
> $max = max($myArray);
> for( $x = 1; $x <= $length; $x++ ) {}
> 
>  -- OR --
> 
> for( $x = 1; $x <= max($myArray); $x++ ) {}
> 
> My gut instinct tells me since PHP is interpreted, that the top one is
> the better way to go, but with the Zend Optimizer, I don't know if PHP
> handles them the same way or not?

With bare PHP, yes the first one is quicker.  Don't know if the Zend Optimiser changes 
that.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP] for??????

2002-10-28 Thread Davy Obdam
Hi Bsantos,

Why not use the following code:

for ($i="0";$i".result['$i']."";
}

I hope this helps. Should be easier then using
$number_of_selected_cols_minus_one because how do u get this one?
Probably like this, right? $number_of_selected_cols_minus_one =
mysql_num_rows($result)-1; This is shorter, and its not necessary to do
- 1 i think

Best regards,
 
Davy Obdam
mailto:info@;davyobdam.com


> -Oorspronkelijk bericht-
> Van: Bsantos PHP [mailto:bruno.santos@;mf.pt] 
> Verzonden: maandag 28 oktober 2002 18:23
> Aan: [EMAIL PROTECTED]
> Onderwerp: [PHP] for??
> 
> 
> Hi people:
> 
> Can anybody help me with this? :
> 
> I've got a query in a table:
> 
> $result = mysql_query("SELECT username, email FROM users");
> 
> which should bring about 300 lines (each for an user).
> 
> Now, I've created a funtion which controls how many fields 
> (cols) may be seen by user. Some like this:
> 
> 
> function select_query ($fields, $table) {
> $result = ("SELECT $fileds FROM $table");
> }
> 
> Well, I hould like to control how many fields my query will use.
> 
> For example: if I call select_query('id,username,email', 'users');
> 
> I want to know that there was selected 3 cols. so I can later 
> do some like
> this:
> 
> for ($j=0;$j<$number_of_selected_cols_minus_one;$j++) {
> echo"$list[$j]";
> 
> ... and that's it. By the way!! Is this late statement correct?!?!
> 
> 
> Thanks a lot to anyone that can help me, cheers,
> 
> 
> 
> bsantos
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> Deze e-mail is door E-mail VirusScanner van Planet Internet 
> gecontroleerd op virussen. Op http://www.planet.nl/evs staat 
> een verwijzing naar de actuele lijst waar op wordt gecontroleerd.
> 
> 



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




RE: [PHP] for??????

2002-10-28 Thread SHEETS,JASON (HP-Boise,ex1)
I believe there is some confusion between columns (fields) and rows.  LIMIT
is generally used to limit the returned rows, not fields.  If you want only
specific columns then select only the ones you want "SELECT
id,firstname,lastname,login FROM users ORDER BY lastname,firstname".

Jason

-Original Message-
From: Martin Hudec [mailto:corwin@;corwin.sk] 
Sent: Monday, October 28, 2002 10:38 AM
To: Bsantos PHP
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] for??

Hello Bsantos,

BP> Now, I've created a funtion which controls how many fields (cols) may be
BP> seen by user. Some like this:

BP> function select_query ($fields, $table) {
BP> $result = ("SELECT $fileds FROM $table");
BP> }

maybe mistype in SELECT fileds should be fieldsalso try using
select_query() without that space between...i suppose you will
have something like select_query("email,name","userlist")

BP> Well, I hould like to control how many fields my query will use.

for example you will want first ten fields...then add
to query LIMIT 0,10 (it will start from first field, and it will
select ten fields)

BP> For example: if I call select_query('id,username,email', 'users');

BP> I want to know that there was selected 3 cols. so I can later do some
like
BP> this:

well three cols are not difficult...just from what position u want to
have them (see LIMIT above)...

BP> for ($j=0;$j<$number_of_selected_cols_minus_one;$j++) {
BP> echo"$list[$j]";

BP> ... and that's it. By the way!! Is this late statement correct?!?!

to this for statement...why are you doing minus one?...for example if
you have 10 selected cols...it will do that echo ten times for each
$jnot nine as in your original statement...you will have one $j
extra...

okay hope it helps for now

-- 
Best regards,
 Martinmailto:corwin@;corwin.sk


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

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




RE: [PHP] for??????

2002-10-28 Thread John W. Holmes
> Now, I've created a funtion which controls how many fields (cols) may
be
> seen by user. Some like this:
> 
> 
> function select_query ($fields, $table) {
> $result = ("SELECT $fileds FROM $table");
> }
> 
> Well, I hould like to control how many fields my query will use.
> 
> For example: if I call select_query('id,username,email', 'users');

$num_fields = count(explode(',',$passed_fields_string));

or

$num_fields = mysql_num_fields($result_set);

---John Holmes...



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




Re: [PHP] for??????

2002-10-28 Thread Martin Hudec
Hello Bsantos,

BP> Now, I've created a funtion which controls how many fields (cols) may be
BP> seen by user. Some like this:

BP> function select_query ($fields, $table) {
BP> $result = ("SELECT $fileds FROM $table");
BP> }

maybe mistype in SELECT fileds should be fieldsalso try using
select_query() without that space between...i suppose you will
have something like select_query("email,name","userlist")

BP> Well, I hould like to control how many fields my query will use.

for example you will want first ten fields...then add
to query LIMIT 0,10 (it will start from first field, and it will
select ten fields)

BP> For example: if I call select_query('id,username,email', 'users');

BP> I want to know that there was selected 3 cols. so I can later do some like
BP> this:

well three cols are not difficult...just from what position u want to
have them (see LIMIT above)...

BP> for ($j=0;$j<$number_of_selected_cols_minus_one;$j++) {
BP> echo"$list[$j]";

BP> ... and that's it. By the way!! Is this late statement correct?!?!

to this for statement...why are you doing minus one?...for example if
you have 10 selected cols...it will do that echo ten times for each
$jnot nine as in your original statement...you will have one $j
extra...

okay hope it helps for now

-- 
Best regards,
 Martinmailto:corwin@;corwin.sk


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




Re: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread Justin French

Or look at the manual for a perfect working example of file uploading.

Why people keep trying to reinvent the wheel is beyond me...


Justin French


on 09/10/02 6:35 AM, 1LT John W. Holmes ([EMAIL PROTECTED]) wrote:

> Just do a print_r($_FILES) and see what all of the contents are.
> 
> ---John Holmes...
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 08, 2002 2:28 PM
> Subject: RE: [PHP] For my next bug... Upload filename gets blanked out
> 
> 
>> <> array.>>
>> 
>> I don't think that's it. Tell me if I'm using it improperly, but I tried
> to
>> print out the filename:
>> 
>> print("[".$_FILES['uploadfile']['name']."]");
>> 
>> Is that it?
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 


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




Re: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread 1LT John W. Holmes

Just do a print_r($_FILES) and see what all of the contents are.

---John Holmes...

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 2:28 PM
Subject: RE: [PHP] For my next bug... Upload filename gets blanked out


> < array.>>
>
> I don't think that's it. Tell me if I'm using it improperly, but I tried
to
> print out the filename:
>
> print("[".$_FILES['uploadfile']['name']."]");
>
> Is that it?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread Jose

I've been having the same problem, sort of. I.e. the blanking out of
POST data when uploading a file, though it also happens in some
instances when using phpMyAdmin when sending an SQL query through its
interface.

I run the whole thing under WindowsXP with PHP 4.2.3, MySQL 3.23.52-nt
(though that has no bearing in the code to upload the file), and PHP
running as a module of Apache 1.3.27 and 1.3.26 before that. phpMyAdmin
is 2.3.1. I have checked and rechecked everything, and can't seem to
find the problem. I do believe that is a bug in the PHP engine, and
possibly the one mentioned at the top of the phpMyAdmin home page at
www.phpmyadmin.net. But not sure how that affects the file uploads.

It happens most of the time, but not always. I do ocasionally get to
upload the file (an image). Same file can succeed or fail. This is in
the windows XP, that I use for development. On the real servers, running
on Solaris and Red Hat Linux but with the same version of PHP and Apache
the same scripts work perfectly!

I posted before and someone suggested to check for the upload dir. I did
and it worked the first time, so I went to claim victory, only to
realize that it was again one off.

I do use register_globals = off (though I have tested with
register_globals = on and the result is the same, even in the error
log). I have checked for sizes of different things where they
correspond. I have also disabled mod_gzip in case it was an issue. I
also set implicit_flush = On to see if that would help, but it didn't.
Set the logs of Apache to debug and yet can't see anything wrong in
there. In this environment I have everything set to report all errors
and notices. The only thing that I see in the error logs is a couple
undefined variables when the POST information dissapears. In the
access.log there is hardly any difference between successful and
unsuccessful uploads.

I have read over 2700 posts (all that has been collected since I
subscribed to the list with my original post) in the hopes that
something would give me a clue as to what is happening, and this thread
is the closest.

I could only think of it being some environment variable limiting some
kind of buffer size or similar, but given that sometimes it works,
sometimes it doesn't with files in different size ranges and coming from
different folders in the system, I had to ditch that idea, for the time
being.

I could also go back to php 4.2.2, but I'm lazy ;) but if that could
help debug? Any ideas when the next version of PHP is coming out? Or can
anyone confirm that there is a bug of PHP on Windows which would
manifest this way?

Any help or further hints deeply appreciated!  :)

Cheers,
 
Jose 

PS. I have attached the httpd.conf and php.ini file. As for the PHP code
I can include it if requested, but it reproducible with a simple upload
form in my system, nothing special.


> -Original Message-
> From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]]
> Sent: 08 October 2002 19:06
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PHP] For my next bug... Upload filename gets blanked out
> 
> Is register_globals off? If it is, you should be using the $_FILES
array.
> 
> ---John Holmes...
> 
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 08, 2002 1:35 PM
> Subject: [PHP] For my next bug... Upload filename gets blanked out
> 
> 
> > In the form below, when I specify a file to upload (in $filename),
it
> gets
> > blanked out by the time I hit the Upload button and the page
refreshes.
> My
> > test file is a text file that certainly does *not* exceed the
> max_file_size
> > (it goes to about 27 k).
> >
> >  "index.php?page=Uploadfile"
> > METHOD = "POST">
> > =
> > "0">
> >   
> >  
> > Upload
> > Upload (filename):  =
> > "FILE" NAME = "filename">
> >  > "102400">
> > 
> >  
> >   
> >
> > 
> >
> >
> 
> 
>

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



httpd.zip
Description: Zip compressed data


php.zip
Description: Zip compressed data

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


Re: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread Kevin Stone

If there is any doubt print the array to find the indexes you need to recall
the filename..

echo "";
print_r($_FILES);
echo "";

You'll figure it out quickly enough.  ::)

-Kevin

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 12:28 PM
Subject: RE: [PHP] For my next bug... Upload filename gets blanked out


> < array.>>
>
> I don't think that's it. Tell me if I'm using it improperly, but I tried
to
> print out the filename:
>
> print("[".$_FILES['uploadfile']['name']."]");
>
> Is that it?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




RE: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread Liam . Gibbs

<>

I don't think that's it. Tell me if I'm using it improperly, but I tried to
print out the filename:

print("[".$_FILES['uploadfile']['name']."]");

Is that it?

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




RE: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread Liam . Gibbs

<>

Hmm. Not sure about register_globals, but I'm not using $_FILES. I assume
its use is $_FILES["name_of_file || size_of_file"]? I'll check it out.

Is there a disadvantage to using it? Ie. If register_globals is on, will it
still work? If there's no disadvantage, I might just go with it anyway
Avoids the hassle the next time I reinstall or switch servers.

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




Re: [PHP] For my next bug... Upload filename gets blanked out

2002-10-08 Thread 1LT John W. Holmes

Is register_globals off? If it is, you should be using the $_FILES array.

---John Holmes...

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 1:35 PM
Subject: [PHP] For my next bug... Upload filename gets blanked out


> In the form below, when I specify a file to upload (in $filename), it gets
> blanked out by the time I hit the Upload button and the page refreshes. My
> test file is a text file that certainly does *not* exceed the
max_file_size
> (it goes to about 27 k).
>
>  METHOD = "POST">
> "0">
>   
>  
> Upload
> Upload (filename):  "FILE" NAME = "filename">
>  "102400">
> 
>  
>   
>
> 
>
>






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


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




Re: [PHP] for loop and array

2002-09-24 Thread Justin French

I think you add square brackets:


so you'd have an array with a numeric key (0-n) and the value of the key
would be the value of the input.


or perhaps you'd prefer


in this case the key of the array would be 'Hepb_ag', and the value would be
true (1).

In both cases, I don't think anything is set for false values... ie, if 3
out of 5 checkboxes are ticked, the array will have 3 items, not 5.


Justin 




on 25/09/02 4:16 PM, Chris Grigor ([EMAIL PROTECTED]) wrote:

> Good Morning all
> 
> I need some help as to how to print this array, its input name is labtype
> and they all have differnet values.
> 
> Amylase
> Cholesterol value='Cholesterol'>
> CMV Ab IgM/G value='CMV'>
> GLUCOSE - Fasting value='GLU_Fast'>
> GLUCOSE - Random value='GLU_Rand'>
> Hepatitus B S Ag value='Hepb_ag'>
> 
> On the page I created if the person selects any of these then it should
> submit it as name=labtype and value="whatever is selected"
> 
> this works.
> 
> Now upon getting this info onto my php script how would I say something like
> 
> for each item in the array labtype, print its value?
> 
> Any help would be really appreciated, I have had a look at a for loop trying
> to use the following
> 
> for ($a=1; $a<50; $a++) {
> echo "$labtype[$a]";
> }
> 
> but this is not working for me. Can anyone direct me in the right way ???
> 


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




Re: [PHP] Re: PHP for AIX.5.1

2002-07-05 Thread Alberto Serra

Scott Fletcher wrote:
> Yea, it use the Linux Kernel.  I had to download RPM stuffs from IBM.  It
> can not be from Red Hat or any other.  IBM take the source code and put it
> into RPM.  IBM kept making error message about some RPMs, so that is why I
> went back to non-linux kernal AIX.
> 

ðÒÉ×ÅÔ!

Try installing the RPMs with the --force parameter. It usually solves 
the problem on Linux and since the kernel is the same...

ÐÏËÁ
áÌØÂÅÒÔÏ
ëÉÅ×

-- 


@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@

LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu?
lOrD i'M sHiNiNg...
YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is
tHe TeSt, YeS iT iS
ThE tEsT, yEs It Is...


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




[PHP] Re: PHP for AIX.5.1

2002-07-05 Thread Scott Fletcher

Yea, it use the Linux Kernel.  I had to download RPM stuffs from IBM.  It
can not be from Red Hat or any other.  IBM take the source code and put it
into RPM.  IBM kept making error message about some RPMs, so that is why I
went back to non-linux kernal AIX.

"Michiel Lange" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> That is because AIX 5.1 uses a linux kernel. That implies alot of changes
> for the architecture...
> However, I think you should be able to compile for 5.1, but you'll need
the
> required libraries which have to be compiled and installed as well...
which
> implies that you need the development stuff like gcc/gmake (I thought
gmake
> was used, from the top of my head)
>
>
> "Scott Fletcher" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Go to PHP website, http://www.php.net and at the top, you'll see the
> > download hyperlink.  Click on that.  Then use the tar.gz file under the
> > title, "Complete Source Code".  This is what I use with AIX.  If you use
> the
> > RPM to install other softwares, then you'll have to make sure the
> > ./configure option can find the files.  It is a matter of using hte
> > environment variables and file paths.  I had end up going back to AIX
> 4.3.3
> > because AIX 5.x use alot of Operating System archecture change.
> >
> > FletchSOD
> >
> > "A Jeyaraj" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Hi all,
> > >
> > > I like to know where i can get the
> > > PHP download for the AIX.5.1
> > >
> > > Pl, let me know the information.
> > >
> > > Regards,
> > > Jey
> > >
> > >
> > > _
> > > There is always a better job for you at Monsterindia.com.
> > > Go now http://monsterindia.rediff.com/jobs
> > >
> >
> >
>
>



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




[PHP] Re: PHP for AIX.5.1

2002-07-05 Thread Michiel Lange

That is because AIX 5.1 uses a linux kernel. That implies alot of changes
for the architecture...
However, I think you should be able to compile for 5.1, but you'll need the
required libraries which have to be compiled and installed as well... which
implies that you need the development stuff like gcc/gmake (I thought gmake
was used, from the top of my head)


"Scott Fletcher" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Go to PHP website, http://www.php.net and at the top, you'll see the
> download hyperlink.  Click on that.  Then use the tar.gz file under the
> title, "Complete Source Code".  This is what I use with AIX.  If you use
the
> RPM to install other softwares, then you'll have to make sure the
> ./configure option can find the files.  It is a matter of using hte
> environment variables and file paths.  I had end up going back to AIX
4.3.3
> because AIX 5.x use alot of Operating System archecture change.
>
> FletchSOD
>
> "A Jeyaraj" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi all,
> >
> > I like to know where i can get the
> > PHP download for the AIX.5.1
> >
> > Pl, let me know the information.
> >
> > Regards,
> > Jey
> >
> >
> > _
> > There is always a better job for you at Monsterindia.com.
> > Go now http://monsterindia.rediff.com/jobs
> >
>
>



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




[PHP] Re: PHP for AIX.5.1

2002-07-05 Thread Scott Fletcher

Go to PHP website, http://www.php.net and at the top, you'll see the
download hyperlink.  Click on that.  Then use the tar.gz file under the
title, "Complete Source Code".  This is what I use with AIX.  If you use the
RPM to install other softwares, then you'll have to make sure the
./configure option can find the files.  It is a matter of using hte
environment variables and file paths.  I had end up going back to AIX 4.3.3
because AIX 5.x use alot of Operating System archecture change.

FletchSOD

"A Jeyaraj" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all,
>
> I like to know where i can get the
> PHP download for the AIX.5.1
>
> Pl, let me know the information.
>
> Regards,
> Jey
>
>
> _
> There is always a better job for you at Monsterindia.com.
> Go now http://monsterindia.rediff.com/jobs
>



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




  1   2   >