Re: [PHP] Re: operators as callbacks?

2008-11-30 Thread Nathan Nobbe
On Sat, Nov 29, 2008 at 5:59 PM, Martin Zvarík [EMAIL PROTECTED] wrote: Joe napsal(a): Is it possible to use a PHP operator as a callback? Suppose I want to add two arrays elementwise, I want to be able to do something like this: array_map('+', $array1, $array2) but this doesn't work as +

[PHP] Re: operators as callbacks?

2008-11-29 Thread Martin Zvarík
Joe napsal(a): Is it possible to use a PHP operator as a callback? Suppose I want to add two arrays elementwise, I want to be able to do something like this: array_map('+', $array1, $array2) but this doesn't work as + is an operator and not a function. I can use the BC library's math functions

Re: [PHP] Bitwise operators and check if an bit is NOT within the flag.

2006-07-07 Thread Richard Lynch
On Tue, July 4, 2006 7:35 am, Mathijs wrote: //Do if VALIDATE_CHECK1 is set BUT NOT when VALIDATE_CHECK3 is set. if ($flag2 self::VALIDATE_CHECK1 $flag2 ~self::VALIDATE_CHECK3) Did you check operator precedence for versus ? Perhaps you just need parentheses... I'm also not at all sure the

[PHP] Bitwise operators and check if an bit is NOT within the flag.

2006-07-04 Thread Mathijs
Hello there. I am working with some bitwise Operators for validating some variables. Now i need to know if an certain bit is NOT set and an other bit IS set. Example. ?php const VALIDATE_CHECK1 = 1; const VALIDATE_CHECK2 = 2; const VALIDATE_CHECK3 = 4; const VALIDATE_ALL= 7; //--Example

Re: [PHP] Bitwise operators and check if an bit is NOT within the flag.

2006-07-04 Thread Jochem Maas
Mathijs wrote: Hello there. I am working with some bitwise Operators for validating some variables. Now i need to know if an certain bit is NOT set and an other bit IS set. Example. ?php const VALIDATE_CHECK1 = 1; const VALIDATE_CHECK2 = 2; const VALIDATE_CHECK3 = 4; const

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Hello there. I am working with some bitwise Operators for validating some variables. Now i need to know if an certain bit is NOT set and an other bit IS set. Example. ?php const VALIDATE_CHECK1 = 1; const VALIDATE_CHECK2 = 2; const VALIDATE_CHECK3 = 4;

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Jochem Maas
Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function single_bit_set(/*int*/ $i)

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Ternary operators

2006-02-16 Thread Jochem Maas
sorry - I have had a php5 CLI at hand for so long I forgot that 'php -r' is not available in v4. that said the 'php -a' option also works (although I always find the interactive mode odd to work with) Kevin Kinsey wrote: Carl Furst wrote: Well, I tried something simple... $ php -r 'echo

[PHP] Ternary operators

2006-02-15 Thread Carl Furst
Hey all, Question about ternary operators. You can't really use functions INSIDE ternary operators, right? They can only be tokens and operators? So $fabulous = true; $fabulous ? echo I am fabulous!\n : echo I am a looser!\n; Would not work? And this: echo $fabulous ? I am fabulous!\n :

Re: [PHP] Ternary operators

2006-02-15 Thread Jochem Maas
Carl Furst wrote: Hey all, Question about ternary operators. You can't really use functions INSIDE ternary operators, right? They can only be tokens and operators? So $fabulous = true; $fabulous ? echo I am fabulous!\n : echo I am a looser!\n; Would not work? testing this is quite

RE: [PHP] Ternary operators

2006-02-15 Thread Carl Furst
, thanks for your help, I was playing around with it and wanted to see what other cool stuff you could do. Carl Furst -Original Message- From: Jochem Maas [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 15, 2006 3:55 PM To: Carl Furst Cc: php-general@lists.php.net Subject: Re: [PHP

Re: [PHP] Ternary operators

2006-02-15 Thread Kevin Kinsey
Carl Furst wrote: Well, I tried something simple... $ php -r 'echo hello world\n;' Error in argument 1, char 2: option not found r Error in argument 1, char 2: option not found r Usage: php [-q] [-h] [-s] [-v] [-i] [-f file] php file [args...] -a Run interactively -C

[PHP] Re: operators

2005-12-28 Thread M. Sokolewicz
please read http://www.php.net/manual/en/language.oop.php explaining what Objects are exactly (since it's looping over an object property which just so happens to be an array) http://www.php.net/manual/en/control-structures.foreach.php explains what = is (part of foreach()) - tul Henry

[PHP] Bitwise operators

2005-09-26 Thread cron
Hello, From php manual: $a $b Shift leftShift the bits of $a $b steps to the left (each step means multiply by two) $a $b Shift rightShift the bits of $a $b steps to the right (each step means divide by two) So i ask what this output? $a = 4; $b = 3; echo $a $b; echo $a $b; Angelo

RE: [PHP] Bitwise operators

2005-09-26 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 9:18 AM said: So i ask what this output? $a = 4; $b = 3; echo $a $b; echo $a $b; You just spent 3-5 minutes writing an email and now almost 10 minutes waiting for a reply to something that would have taken

Re: [PHP] Bitwise operators

2005-09-26 Thread Robin Vickery
On 9/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From php manual: $a $b Shift leftShift the bits of $a $b steps to the left (each step means multiply by two) $a $b Shift rightShift the bits of $a $b steps to the right (each step means divide by two) So i ask what this output? $a

Re: [PHP] Bitwise operators

2005-09-26 Thread cron
[EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, September 26, 2005 1:28 PM Subject: RE: [PHP] Bitwise operators [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 9:18 AM said: So i ask what this output? $a = 4; $b = 3; echo $a $b; echo $a $b

Re: [PHP] Bitwise operators

2005-09-26 Thread Chris Boget
I tested; I don't want to waste peoples time. Rewriting the question: this outputs: c = 32 d = 0 The question is why? First row is the bit's number and the second row is the bit's value: #8 | #7 | #6 | #5 | #4 | #3 | #2 | #1 --- 128 | 64 | 32 | 16 | 8 |

Re: [PHP] Bitwise operators

2005-09-26 Thread cron
The second value is the number of spaces to shift, dint realize that. Thanks for your time Chris. Angelo - Original Message - From: Chris Boget [EMAIL PROTECTED] To: [EMAIL PROTECTED]; php-general@lists.php.net Sent: Monday, September 26, 2005 2:02 PM Subject: Re: [PHP] Bitwise

Re: [PHP] Do PHP boolean operators short circuit?

2003-09-20 Thread Curt Zirzow
* Thus wrote Jason Wong ([EMAIL PROTECTED]): On Saturday 20 September 2003 10:57, John W. Holmes wrote: [snip] From my experience, it will work that way. I don't know if it's that way for every version or not, though. manual Migrating from PHP/FI 2 to PHP 3 heh... i havn't seen a

[PHP] Do PHP boolean operators short circuit?

2003-09-19 Thread Dan Anderson
I am learning perl and my book describes boolean short circuiting. Basically: function1() OR function2(); (function2 never is evaluated if function1 is true). Will this work in PHP for any function? Thanks in advance, -Dan -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Do PHP boolean operators short circuit?

2003-09-19 Thread John W. Holmes
Dan Anderson wrote: I am learning perl and my book describes boolean short circuiting. Basically: function1() OR function2(); (function2 never is evaluated if function1 is true). Will this work in PHP for any function? Yes. From my experience, it will work that way. I don't know if it's

Re: [PHP] Do PHP boolean operators short circuit?

2003-09-19 Thread Jason Wong
On Saturday 20 September 2003 10:57, John W. Holmes wrote: [snip] From my experience, it will work that way. I don't know if it's that way for every version or not, though. manual Migrating from PHP/FI 2 to PHP 3 -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software

[PHP] and Operators

2002-05-21 Thread Jonathan Rosenberg
Are the and operators identical in semantics to those operators in C? In particular, do they handle sign extension in the same manner? -- JR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Operators

2002-01-10 Thread CC Zona
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Gerard Samuel) wrote: If != is the opposite of == What is the opposite of === ?? !($something===$somethingelse) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

[PHP] variable operators in queries

2001-10-19 Thread Sander Peters
Hello, Is it possible to put variable operators in queries? I tried this (the real variable comes from a form) $Date_Operator =(=); sql=SELECT * FROM poeple WHERE age $Date_operator 20; $result_id = mysql_query($sql); It doesn't work like this. I also tried: sql=SELECT * FROM poeple WHERE

Re: [PHP] comparison operators

2001-05-21 Thread Christian Reiniger
On Monday 21 May 2001 08:03, Heidi Belal wrote: I have a form where i let people choose a file to upload, but i want to limit them to image files only. So i want to only allow the .gif and .jpg to be uploaded. What i tried doing was this: if ($filename_type == image/gif) -- upload file

[PHP] comparison operators

2001-05-20 Thread Heidi Belal
Hi All! i'm creating this form for people to upload pictures, so i want to be able to compare the type of the file, so that if it's not a .gif or a .jpg i give them an error message! What i am using is: If ($userfile_type == image/gif) - here it uploads the file otherwise it sends out an

[PHP] comparison operators

2001-05-20 Thread Heidi Belal
Hi All! i'm creating this form for people to upload pictures, so i want to be able to compare the type of the file, so that if it's not a .gif or a .jpg i give them an error message! What i am using is: If ($userfile_type == image/gif) - here it uploads the file otherwise it sends out an

[PHP] comparison operators

2001-05-20 Thread Heidi Belal
Hi All! i'm creating this form for people to upload pictures, so i want to be able to compare the type of the file, so that if it's not a .gif or a .jpg i give them an error message! What i am using is: If ($userfile_type == image/gif) - here it uploads the file otherwise it sends out an

Re: [PHP] comparison operators

2001-05-20 Thread Diego Pérez Rández
Hi: For compare strings you can use strcmp. $st1 = hi; $st2 = bye; if (strcmp($st1, $st2)) { echo are different; } else { echo are equal; } The strcmp return 0 when the strings are equal. If the strings are diferent, return the pos of the char where begin the diference. I

[PHP] comparison operators

2001-05-20 Thread Heidi Belal
Hi All, I have a form where i let people choose a file to upload, but i want to limit them to image files only. So i want to only allow the .gif and .jpg to be uploaded. What i tried doing was this: if ($filename_type == image/gif) -- upload file otherwise give an error message! but for