On 24/02/2010 05:46, Rob Gould wrote:
> I'm not sure if I need to write a PHP for-loop to do this, or if it can all
> be done in one SQL statement?
>
> Basically, I want to copy all the barcodes from one table and put them into
> another table, but only if the barcode in the first table > 0, and
This can also be done with double pipes, which is what is used in many
other languages.
-
if($audio=="Cool" || $audio=="junk" || $audio=="Funky"){
Do this
} else{
Do this
}
--
As far as I can tell there are no plans to remove or reaso
> > This work fine, however, I would like to add to the criteria above. I would
> > like to say:
> >
> > if ($audio == "Cool" or "junk" or "funky"){
> >
> > ...
> >
>
> if (in_array($audio,array("Cool","junk","funky"))) {
> ...
> }
>
Yes that's one way but to answer the question:
if ($a ==
> This work fine, however, I would like to add to the criteria above. I would
> like to say:
>
> if ($audio == "Cool" or "junk" or "funky"){
>
> ...
>
if (in_array($audio,array("Cool","junk","funky"))) {
...
}
not the most elegant looking but it gets the job done.
/josh w
--
PHP General Ma
Hi,
Friday, March 25, 2005, 11:27:30 AM, you wrote:
MD> Hello,
MD> I would like to first thank everyone for their help with the last few
MD> questions I have had. I really appreciate it.
MD> Here is my question:
MD> if ($audio == "Cool"){
MD> Do this
MD> }else{
MD> Do that
MD> }
MD> This
pmpa wrote:
Thanks Jochem. You're great!
no. rasmus, for instance, is great. I'm a parrot :-)
but thanks for the compliment.
should a parrot respond to a thank you?
-Mensagem original-
De: Jochem Maas [mailto:[EMAIL PROTECTED]
pmpa wrote:
Hi all!
This is probably a stupid question, b
Thanks Jochem. You're great!
-Mensagem original-
De: Jochem Maas [mailto:[EMAIL PROTECTED]
pmpa wrote:
> Hi all!
>
> This is probably a stupid question, but I have to ask :)
> Which takes less processing?
not stupid.
say there is a few microseconds of difference in the parsing/compil
On Sun, 2005-02-27 at 14:33, pmpa wrote:
> Hi all!
>
> This is probably a stupid question, but I have to ask :)
> Which takes less processing?
Run a test. Regardless though, since the parsing time is so miniscule, I
always use // for comments so that when I want to temporarily comment
out blocks
pmpa wrote:
Hi all!
This is probably a stupid question, but I have to ask :)
Which takes less processing?
not stupid.
say there is a few microseconds of difference in the parsing/compiling
(in the case of comments the zend engine is more or less stripping
them out as far as 'building a runable scri
[EMAIL PROTECTED] wrote:
Hi there all!
I'm thinking of the "or die" suffix (or option or whatever it is called)...
I can use or die together with opening a db.
open_mysqldb("bla.bla.") or die("couldn't connect to db");
But this is just useful when developing?
I don't want my users to see that a spe
Hi
Am So, 2004-04-25 um 16.00 schrieb -{ Rene Brehmer }-:
> According to historical records, on Sun, 25 Apr 2004 17:14:13 +1000 Aidan
> Lister wrote about "[PHP] OR":
[...]
> || && |! &!
> ^ being OR, AND, NOR, and NAND (believe NOR is actually called XOR, can't
> remember ...)
Just to help yo
BEEP wrong :)
http://www.php.net/manual/en/language.operators.php#language.operators.precedence
therefore:
$a AND $b OR $c AND $d
is not equal
$a AND $b || $c AND $d
but is equal to
$a && $b || $c && $d
-- red
Evan Nemerson wrote:
On Sunday 25 April 2004 12:14 am, Aidan Lister wrote:
if (
According to historical records, on Sun, 25 Apr 2004 17:14:13 +1000 Aidan
Lister wrote about "[PHP] OR":
>if (cond || cond2)
>
>OR
>
>if (cond OR cond2)
>
>
>What do you use, and why?
I always use ||
basically because to me it's easier to read in more complex statements ...
like this:
if ((
On Sunday 25 April 2004 12:14 am, Aidan Lister wrote:
> if (cond || cond2)
>
> OR
>
> if (cond OR cond2)
>
>
> What do you use, and why?
Doesn't matter- personal preference.
--
Evan Nemerson
[EMAIL PROTECTED]
http://coeusgroup.com/en
--
"There is a certain right by which we may deprive a man o
> if (cond || cond2)
>
> OR
>
> if (cond OR cond2)
>
>
> What do you use, and why?
>
> --
|| coz its easier to type ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On 08 October 2003 17:20, Chris Shiflett wrote:
> > The internals developers probably didn't see a need to provide
> > support for "return" in conditionals since it can't return a value
> > to the conditional.
>
> Ugh. This is the same misconception, again. Let's try some different
> code:
>
>
--- "Ford, Mike [LSS]" <[EMAIL PROTECTED]> wrote:
> No, it's not -- the misconception appears to be yours.
Well, perhaps it is a difference in perspective. Yes, "or" and "||" can be
exchanged:
1. if ($foo or $bar) blah();
2. mysql_query($sql) || die(mysql_error());
My point was to differentiate
> The internals developers probably didn't see a need to provide
> support for "return" in conditionals since it can't return a value
> to the conditional.
Ugh. This is the same misconception, again. Let's try some different code:
The return of foo() does not matter. It is not evaluated. I do n
On 08 October 2003 16:43, Robert Cummings contributed these pearls of wisdom:
> On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
>> * Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
>>> --- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>"
> <[EMAIL PROTECTED]> wrote:
Firstly, "or", as a Boolean operator
On 08 October 2003 16:13, Chris Shiflett contributed these pearls of wisdom:
> --- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]>
> wrote:
>> Firstly, "or", as a Boolean operator requires two operands,
>> both of which must have an actual value.
>
> [snip]
>
>> statements don't hav
* Thus wrote Robert Cummings ([EMAIL PROTECTED]):
> On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
> > * Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
> > > --- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]> wrote:
> > > > Firstly, "or", as a Boolean operator requires two operands, b
On Wed, 2003-10-08 at 11:43, Curt Zirzow wrote:
> * Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
> > --- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]> wrote:
> > > Firstly, "or", as a Boolean operator requires two operands, both of
> > > which must have an actual value.
> >
> > [sn
* Thus wrote Chris Shiflett ([EMAIL PROTECTED]):
> --- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]> wrote:
> > Firstly, "or", as a Boolean operator requires two operands, both of
> > which must have an actual value.
>
> [snip]
>
> > statements don't have a value (and can't even be
--- "Ford, Mike [LSS]" <[EMAIL PROTECTED]>" <[EMAIL PROTECTED]> wrote:
> Firstly, "or", as a Boolean operator requires two operands, both of
> which must have an actual value.
[snip]
> statements don't have a value (and can't even be coerced to have
> one), so "return" can't be valid as one of th
On 07 October 2003 18:15, Pat Carmody contributed these pearls of wisdom:
> So far everyone is telling me that it won't work, but no one
> is telling me
> why. (btw I did search extensively for the answer to this
> question but so
> far have found nothing). Robert, could you be more specific
> in
On Tue, 2003-10-07 at 16:53, Pat Carmody wrote:
>
> On Tue, 7 Oct 2003, Curt Zirzow wrote:
>
> >> function istrue() {
> >> return true;
> >> }
> >> function retor_test() {
> >> istrue() or return( "False" );
> >> return "True";
> >> }
>
> > return (istrue()? 'True': 'False');
> >
> >hmm..
On Tue, 7 Oct 2003, Curt Zirzow wrote:
>> function istrue() {
>> return true;
>> }
>> function retor_test() {
>> istrue() or return( "False" );
>> return "True";
>> }
> return (istrue()? 'True': 'False');
>
>hmm.. less typing, easier to understand and logically readable.
This doesn't an
--- Curt Zirzow <[EMAIL PROTECTED]> wrote:
> I wouldn't call this lazy, more like sloppy and confusing.
>
> return (istrue()? 'True': 'False');
>
> hmm.. less typing, easier to understand and logically readable.
Well, that is arguable. :-) I'm not a big fan of the ternary operator when it
co
* Thus wrote Pat Carmody ([EMAIL PROTECTED]):
>
>
> Calling the following retor_test() function causes a "Parse error: parse
> error, unexpected T_RETURN" message when the script is run:
>
> function istrue() {
> return true;
> }
> function retor_test() {
> istrue() or return( "False" );
>
On Tue, 2003-10-07 at 15:35, Leif K-Brooks wrote:
> Robert Cummings wrote:
>
> > Generally it doesn't look like a function since you can do:
> >
> >return 'foo'
> >
> >which has no parenthesis. The parenthesis are optional and only used to
> >return the result of an expression.
> >
> The same
--- Leif K-Brooks <[EMAIL PROTECTED]> wrote:
> The same is true of exit/die.
Right, Robert mentioned this earlier. :-)
So, in summation, someone asked why return wasn't given the same support as
exit (of which die is an alias), and a lot of discussion that didn't answer
this question followed. :-
Robert Cummings wrote:
Generally it doesn't look like a function since you can do:
return 'foo'
which has no parenthesis. The parenthesis are optional and only used to
return the result of an expression.
The same is true of exit/die.
--
The above message is encrypted with double rot13 encodi
> Generally it doesn't look like a function since you can do:
>
> return 'foo'
>
> which has no parenthesis.
True enough.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, 2003-10-07 at 15:08, Chris Shiflett wrote:
> --- Robert Cummings <[EMAIL PROTECTED]> wrote:
> > Given that die() and exit() works just means they have been given
> > support for this context.
>
> I think you now understand the original poster's question. From my
> interpretation, he simply
On Tue, 2003-10-07 at 15:05, Roger B.A. Klorese wrote:
>
> Sounds to me that if it looks like a function, quacks like a function, etc.,
> only a broken language definition would treat it differently from a
> function...
Generally it doesn't look like a function since you can do:
return 'foo'
--- Robert Cummings <[EMAIL PROTECTED]> wrote:
> Given that die() and exit() works just means they have been given
> support for this context.
I think you now understand the original poster's question. From my
interpretation, he simply wanted to know why return was not given the same
support. :-)
> I would say the real issue at hand here is that the return
> statement is
> not a fucntion, but rather a language construct, thus it
> cannot be used
> as a function unless explicitly stated as so. The reason a parse error
> is occurring is because this particular construct has no support for
>
--- Robert Cummings <[EMAIL PROTECTED]> wrote:
> The original post came from someone being lazy, that appears to be
> influencing my take on the thread :)
Understandable. :-)
> Also given the above code, it's completely pointless since the first
> operand is true and so it is impossible for retur
On Tue, 2003-10-07 at 15:00, Jason Wong wrote:
>
> The example given by Leif does not even run. You get a parse error. So all the
> discussion about return exiting immediately and the left expression
> evaluating to whatever is (IMHO) moot. Apparently PHP does not allow you to
> use return like
On Tue, 2003-10-07 at 14:51, Robert Cummings wrote:
>
> The original post came from someone being lazy, that appears to be
> influencing my take on the thread :) Also given the above code, it's
> completely pointless since the first operand is true and so it is
> impossible for return( 'foo' ) to e
On Wednesday 08 October 2003 02:51, Robert Cummings wrote:
> The original post came from someone being lazy, that appears to be
> influencing my take on the thread :) Also given the above code, it's
> completely pointless since the first operand is true and so it is
> impossible for return( 'foo'
On Tue, 2003-10-07 at 14:45, Chris Shiflett wrote:
> --- Robert Cummings <[EMAIL PROTECTED]> wrote:
> > > >Directly from the docs:
> > > >
> > > >http://ca3.php.net/manual/en/function.return.php
> > > >
> > > >First line:
> > > >
> > > >"If called from within a function, the return() statem
--- Robert Cummings <[EMAIL PROTECTED]> wrote:
> > >Directly from the docs:
> > >
> > >http://ca3.php.net/manual/en/function.return.php
> > >
> > >First line:
> > >
> > >"If called from within a function, the return() statement
> > > immediately ends execution of the current function"
>
On Tue, 2003-10-07 at 14:40, Roger B.A. Klorese wrote:
> > How can you possibly test, in a conditional, the return value of the
> > return statement itself when it has no value to return and even causes
> > the current scope to exit IMMEDIATELY??
>
> Per the logic, if it returns immediately, isn't
> How can you possibly test, in a conditional, the return value of the
> return statement itself when it has no value to return and even causes
> the current scope to exit IMMEDIATELY??
Per the logic, if it returns immediately, isn't the value irrelevant? That
is, assuming that the truth of the f
Robert Cummings wrote:
How can you possibly test, in a conditional, the return value of the
return statement itself when it has no value to return and even causes
the current scope to exit IMMEDIATELY??
Ok, that explains it. Thanks.
--
The above message is encrypted with double rot13 encoding
On Tue, 2003-10-07 at 14:29, Leif K-Brooks wrote:
> Robert Cummings wrote:
>
> >Directly from the docs:
> >
> >http://ca3.php.net/manual/en/function.return.php
> >
> >First line:
> >
> >"If called from within a function, the return() statement
> > immediately ends execution of the curr
Robert Cummings wrote:
Directly from the docs:
http://ca3.php.net/manual/en/function.return.php
First line:
"If called from within a function, the return() statement
immediately ends execution of the current function"
Important concept:
IMMEDIATELY returns.
Learn to read.
What
> Why won't any of you give a good reason why it won't work? How come this
> works:
>
> function foo() {
> 2+2==4 or die("The world is ending, or at least your processor!");
> }
>
> But this doesn't:
>
> function foo() {
> 2+2==4 or return("The world is ending, or at least your processo
Chris Sherwood wrote:
Well Unfortunately pat
You are going to have to be an unlazy man and use an if statement
Why won't any of you give a good reason why it won't work? How come this
works:
function foo() {
2+2==4 or die("The world is ending, or at least your processor!");
}
But this does
On Tue, Oct 07, 2003 at 01:02:36PM -0400, Pat Carmody wrote:
:
: Calling the following retor_test() function causes a "Parse error: parse
: error, unexpected T_RETURN" message when the script is run:
:
: function istrue() {
: return true;
: }
: function retor_test() {
: istrue() or return( "F
I already said "Your laziness is causing you problems", this refers back
to your original statement about being lazy. You should be able to infer
form your own wrods the root of your problem.
Rob.
On Tue, 2003-10-07 at 13:14, Pat Carmody wrote:
>
> So far everyone is telling me that it won't wor
So far everyone is telling me that it won't work, but no one is telling me
why. (btw I did search extensively for the answer to this question but so
far have found nothing). Robert, could you be more specific in your
reference to the http://www.php.net documentation? I see nothing on the
basic s
Incidentally your post probably caused you more work than to have tested
it yourself. So much for your laziness even being optimal laziness.
*pt*. I thought making stupid posts was covered in the newbie
guide!?!
Rob.
On Tue, 2003-10-07 at 13:06, Robert Cummings wrote:
> On Tue, 2003-10-07 at
Well Unfortunately pat
You are going to have to be an unlazy man and use an if statement
Chris
>
> Calling the following retor_test() function causes a "Parse error: parse
> error, unexpected T_RETURN" message when the script is run:
>
> function istrue() {
> return true;
> }
> function retor_
On Tue, 2003-10-07 at 13:02, Pat Carmody wrote:
>
>
> Calling the following retor_test() function causes a "Parse error: parse
> error, unexpected T_RETURN" message when the script is run:
>
> function istrue() {
> return true;
> }
> function retor_test() {
> istrue() or return( "False" );
>
Depends on too many things. Try it on your system and see...
Wild Guess:
PHP as a Module probably beats out SSI, but SSI probably beats out PHP as
CGI.
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.
Thank you s much david.
"David Robley" <[EMAIL PROTECTED]> wrote in message
01072515394001.32266@www">news:01072515394001.32266@www...
> On Wed, 25 Jul 2001 13:36, J S R wrote:
> > Shouldn't this work? I did it because I want the link to change to the
> > "top-alt" class when the certain link
On Wed, 25 Jul 2001 13:36, J S R wrote:
> Shouldn't this work? I did it because I want the link to change to the
> "top-alt" class when the certain link is selected.
>
> but when i do this... they "if" statement is always active even if its
> not on the page.
>
> what am i doing wrong.
Several t
Why aren't you using the brackets?
if (statement){
} else {
}
SED
-Original Message-
From: J S R [mailto:[EMAIL PROTECTED]]
Sent: 25. júlí 2001 04:06
To: [EMAIL PROTECTED]
Subject: [PHP] "OR" Problems
Shouldn't this wo
60 matches
Mail list logo