Re: [PHP] Comparing data - big file

2009-06-01 Thread Per Jessen
דניאל דנון wrote: > As continuation to my last question, I got another one. > > a brief summary: > I had to process a file that contains 700,000 lines, > each line contained some data (lets assume each line was like: > name|age|work|lastaccessed) > age contains the person's age in time() format,

[PHP] Comparing data - big file

2009-06-01 Thread דניאל דנון
As continuation to my last question, I got another one. a brief summary: I had to process a file that contains 700,000 lines, each line contained some data (lets assume each line was like: name|age|work|lastaccessed ) age contains the person's age in time() format, how many seconds has past since

Re: [PHP] Comparing strings (revisited)

2009-05-27 Thread Clancy
On Mon, 25 May 2009 02:11:24 -0400, pa...@quillandmouse.com (Paul M Foster) wrote: . > >This is why I originated a thread along these lines some time ago. I >sympathize with your pain, being a C programmer as well. Apparently, PHP >plays fast and loose with types when doing == comparison

Re: [PHP] Comparing strings (revisited)

2009-05-24 Thread Paul M Foster
On Mon, May 25, 2009 at 12:46:16PM +1000, Clancy wrote: > For some time I have been working on a text based database, in which each > entry contains > one or more lines of data, with the various fields delimited by semicolons, > e.g. > > A;b;20GM;Restaurant;090508 > n;;;Arintji;; > a;Federati

Re: [PHP] Comparing strings (revisited)

2009-05-24 Thread Eddie Drapkin
With the initial explode, I may be wrong but I don't think it's possible to force every entry to be string-typed. However, this little snippet could help: $foo = explode(';', $db); foreach($foo as &$bar) { $bar = settype($bar, 'string); } which will set each element's type to string, but is hardl

[PHP] Comparing strings (revisited)

2009-05-24 Thread Clancy
For some time I have been working on a text based database, in which each entry contains one or more lines of data, with the various fields delimited by semicolons, e.g. A;b;20GM;Restaurant;090508 n;;;Arintji;; a;Federation Square;;; p;9663 9900;;;9663 9901;;i...@arintji.com.au; All was goin

Re: [PHP] Comparing file creating dates...

2008-03-22 Thread Al
you may need to use filemtime() and not filectime(); Jim Lucas wrote: Ryan S wrote: Hey all, Heres what i am trying to do: When someone sends a message from my site, i take their ip address and make a file with their ip address in a directory called "hash-directory", the file looks like thi

Re: [PHP] Comparing file creating dates...

2008-03-22 Thread Jim Lucas
Ryan S wrote: Hey all, Heres what i am trying to do: When someone sends a message from my site, i take their ip address and make a file with their ip address in a directory called "hash-directory", the file looks like this: 169.34.534.243.txt I want to make sure they cant send too many messa

[PHP] Comparing file creating dates...

2008-03-22 Thread Ryan S
Hey all, Heres what i am trying to do: When someone sends a message from my site, i take their ip address and make a file with their ip address in a directory called "hash-directory", the file looks like this: 169.34.534.243.txt I want to make sure they cant send too many messages because of t

RE: [PHP] Comparing files

2008-03-12 Thread Thijs Lensselink
Quoting Andrés Robinet <[EMAIL PROTECTED]>: -Original Message- From: Edward Kay [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2008 7:13 AM To: mathieu leddet; php-general@lists.php.net Subject: RE: [PHP] Comparing files > -Original Message- > From: ma

RE: [PHP] Comparing files

2008-03-12 Thread Edward Kay
> -Original Message- > From: Andrés Robinet [mailto:[EMAIL PROTECTED] > Sent: 12 March 2008 12:33 > To: 'Edward Kay'; 'mathieu leddet'; php-general@lists.php.net > Subject: RE: [PHP] Comparing files > > > > -Original Message

RE: [PHP] Comparing files

2008-03-12 Thread Andrés Robinet
> -Original Message- > From: Edward Kay [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 12, 2008 7:13 AM > To: mathieu leddet; php-general@lists.php.net > Subject: RE: [PHP] Comparing files > > > > > -Original Message- > > From: mat

RE: [PHP] Comparing files

2008-03-12 Thread Per Jessen
mathieu leddet wrote: > Yes! > > Thanks a lot, "md5_file" suits perfectly well my needs. > I've read that 'exec'ing the md5 command is faster... I'll see when > performance on large files will become an issue. > Doing a diff on the files would make absolutely certain - an md5 checksum is not.

RE: [PHP] Comparing files

2008-03-12 Thread mathieu leddet
k [mailto:[EMAIL PROTECTED] Envoyé : Wednesday, March 12, 2008 12:09 PM À : php-general@lists.php.net Objet : Re: [PHP] Comparing files Quoting mathieu leddet <[EMAIL PROTECTED]>: > Hi all, > > I have a simple question : how can I ensure that 2 files

RE: [PHP] Comparing files

2008-03-12 Thread Edward Kay
> -Original Message- > From: mathieu leddet [mailto:[EMAIL PROTECTED] > Sent: 12 March 2008 11:04 > To: php-general@lists.php.net > Subject: [PHP] Comparing files > > > Hi all, > > I have a simple question : how can I ensure that 2 files are identical ? >

Re: [PHP] Comparing files

2008-03-12 Thread Aschwin Wesselius
mathieu leddet wrote: Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8<-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents

Re: [PHP] Comparing files

2008-03-12 Thread Stut
mathieu leddet wrote: I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8<-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2))

Re: [PHP] Comparing files

2008-03-12 Thread Thijs Lensselink
Quoting mathieu leddet <[EMAIL PROTECTED]>: Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8<-- function files_identical($path1, $path2) { return (file_get_contents($path1) == fi

[PHP] Comparing files

2008-03-12 Thread mathieu leddet
Hi all, I have a simple question : how can I ensure that 2 files are identical ? How about this ? 8<-- function files_identical($path1, $path2) { return (file_get_contents($path1) == file_get_contents($path2)); } 8

Re: Re[2]: [PHP] Comparing string to array

2007-06-20 Thread Robin Vickery
On 19/06/07, Richard Davey <[EMAIL PROTECTED]> wrote: Hi Robin, Tuesday, June 19, 2007, 8:28:50 PM, you wrote: > On 19/06/07, Richard Davey <[EMAIL PROTECTED]> wrote: >> $userparam = "test['sam'][]"; >> >> // How to check if $userparam exists in the $_POST array >> // and get all

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Robin, Tuesday, June 19, 2007, 8:28:50 PM, you wrote: > On 19/06/07, Richard Davey <[EMAIL PROTECTED]> wrote: >> $userparam = "test['sam'][]"; >> >> // How to check if $userparam exists in the $_POST array >> // and get all the values from it? > full_key_exists("test['sam'][]",

Re: [PHP] Comparing string to array

2007-06-19 Thread Robin Vickery
On 19/06/07, Richard Davey <[EMAIL PROTECTED]> wrote: $userparam = "test['sam'][]"; // How to check if $userparam exists in the $_POST array // and get all the values from it? full_key_exists("test['sam'][]", $_POST) // returns true if key is set full_find_key("test['sam'][]", $

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START $userparam = "test['sam'][]"; // How to check if $userparam exists in the $_

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Stut wrote: Jim Lucas wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: Jim Lucas wrote: $userparam = "test['sam'][]"; then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 6:21:25 PM, you wrote: > let me try this again. > in the submitted $_POST array, you are looking for a key (test) that contains > a given $username > that may or may not have any values set? > Correct? Sorry not even close. Here, let me try again... $param =

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Jim Lucas wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: Jim Lucas wrote: $userparam = "test['sam'][]"; then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the quotes from i

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: Jim Lucas wrote: $userparam = "test['sam'][]"; then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the quotes from it and then attempt

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: Jim Lucas wrote: $userparam = "test['sam'][]"; then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the quotes from it and then attempt

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Jim Lucas wrote: Stut wrote: Jim Lucas wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for in

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: > Jim Lucas wrote: >>> $userparam = "test['sam'][]"; > then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the quotes from it and then attempt my original questio

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Jim Lucas wrote: $userparam = "test['sam'][]"; then what you are saying it that this HAS to be your search string? -- 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

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Stut wrote: Jim Lucas wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an arra

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Jim Lucas wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an array key. Cheer

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:29:55 PM, you wrote: > Richard Davey wrote: >> Hi Jim, >> >> Tuesday, June 19, 2007, 5:06:47 PM, you wrote: >> >>> DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE >> >> Hate to piss on your bonfire but a single quote is a perfectly valid >> (if somewhat stu

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE where in this sentence did I say that it was invalid? just told you not to use them, because it is going to mess with your output Hate to piss on your bonfire bu

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an array key. Cheers, Rich if you

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an array key. Cheers, Rich in this

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: > DON'T USE SINGLE QUOTES IN YOUR NAME="" ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an array key. Cheers, Rich -- Zend Certified Engineer http

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START $userparam = "test['sam'][]"; // How to check if $userparam exists in the $_

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: Hi Stut, Tuesday, June 19, 2007, 1:49:53 PM, you wrote: Very nice, thank you. I was hoping there would be a way to do it without resorting to eval(), but if even you can't figure out how, I'm not going to waste any more time trying to either :) You probably could by bre

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 1:49:53 PM, you wrote: >> Very nice, thank you. I was hoping there would be a way to do it >> without resorting to eval(), but if even you can't figure out how, I'm >> not going to waste any more time trying to either :) > You probably could by breaking it into e

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: Hi Stut, Tuesday, June 19, 2007, 1:16:54 PM, you wrote: The problem is finding a way to expand the input name (which is a string) into a format that $_POST can be searched for. Or do the reverse, iterate through $_POST to find a match for the input name and get that value.

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 1:16:54 PM, you wrote: >> The problem is finding a way to expand the input name (which is a >> string) into a format that $_POST can be searched for. Or do the >> reverse, iterate through $_POST to find a match for the input name and >> get that value. > Try this

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: Hi Stut, Tuesday, June 19, 2007, 12:09:12 PM, you wrote: If you have no control over what the fields in the form will be, what are you doing with the data? Surely if you're writing logic that requires you to know what the fields are called, you need to have control over

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 12:09:12 PM, you wrote: > If you have no control over what the fields in the form will be, what > are you doing with the data? Surely if you're writing logic that > requires you to know what the fields are called, you need to have > control over it. Here, this

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: Hi Stut, Tuesday, June 19, 2007, 10:16:02 AM, you wrote: If you can't control $userparam and it has to look like you have it then you're parsing of it is a little more involved, but still fairly simple. What are you actually trying to do? Where will $userparam actually

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 10:16:02 AM, you wrote: > If you can't control $userparam and it has to look like you have it then > you're parsing of it is a little more involved, but still fairly simple. > What are you actually trying to do? Where will $userparam actually come > from? There i

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START $userparam = "test['sam'][]"; // How to check if $userparam exists in the $_

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Larry, Tuesday, June 19, 2007, 2:55:07 AM, you wrote: > Perhaps you're looking for in_array()? If only it was that simple! But pray tell how an in_array search is going to find: $userparam = "test['bob'][]"; within: Array ( [test] => Array ( ['bob'] => Array

Re: [PHP] Comparing string to array

2007-06-18 Thread Larry Garfield
Perhaps you're looking for in_array()? On Monday 18 June 2007, Richard Davey wrote: > Hi all, > > Ok it's 2am, my brain has gone to mush and I am having trouble > figuring out an easy way to do this, can anyone shed some light? > > Take a peek at the following code: > > // START > > print_r(

[PHP] Comparing string to array

2007-06-18 Thread Richard Davey
Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START red green blue red2 green2 blue2 // END From the code above I'm trying to figure out how to tell if the $

Re: [PHP] Comparing strings... need advice. :)

2006-08-29 Thread Micky Hulse
Ivo F.A.C. Fokkema wrote: Ah, thanks. Misunderstood the question, then. Thought just checking if it's a file in that directory was what's needed. You were right. :) I did not plan on looking-in anything other than one or two hard-coded folder locations. But, it is good to know the details. ;)

Re: [PHP] Comparing strings... need advice. :)

2006-08-29 Thread Ivo F.A.C. Fokkema
On Mon, 28 Aug 2006 19:39:49 -0400, Robert Cummings wrote: > On Mon, 2006-08-28 at 16:50 +0200, Ivo F.A.C. Fokkema wrote: >> On Mon, 28 Aug 2006 09:47:02 +0100, Stut wrote: >> > Micky Hulse wrote: >> >> I am looking for the most secure/efficient way to compare these two >> >> strings: >> >> >> >>

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Robert Cummings wrote: Readfile works great, it's the same as file_get_contents() and then Ah, good to hear. :D issuing an echo. You may want to also stored content generated by web users outside of the web tree. There may not be any issue with how you [...] with PHP tags and accesses it dir

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 17:07 -0700, Micky Hulse wrote: > Hi Robert, > > Robert Cummings wrote: > > How are these saved files then imported into the content? Are they > > included or do you retrieve the contents using something like file(), > > file_get_contents(), or fread() and then echo it? If yo

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Hi Robert, Robert Cummings wrote: How are these saved files then imported into the content? Are they included or do you retrieve the contents using something like file(), file_get_contents(), or fread() and then echo it? If you are using Currently I am using readfile() (plus some other securit

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 16:28 -0700, Micky Hulse wrote: > Wow, thanks for all the great information folks (Stut, Ivo, Rob, and David.) > > I really appreciate all of the top-notch advice and expert information. :D > > Looks like I have a lot to think about... > > Currently, I hard-code the paths t

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 16:50 +0200, Ivo F.A.C. Fokkema wrote: > On Mon, 28 Aug 2006 09:47:02 +0100, Stut wrote: > > > Micky Hulse wrote: > >> I am looking for the most secure/efficient way to compare these two > >> strings: > >> > >> /folder1/folder2/folder3/folder4/ > >> /folder1/folder2/folder3/

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Wow, thanks for all the great information folks (Stut, Ivo, Rob, and David.) I really appreciate all of the top-notch advice and expert information. :D Looks like I have a lot to think about... Currently, I hard-code the paths to the folders that house the files I want my CMS to edit (via a co

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Robert Cummings
On Mon, 2006-08-28 at 09:47 +0100, Stut wrote: > Micky Hulse wrote: > > I am looking for the most secure/efficient way to compare these two > > strings: > > > > /folder1/folder2/folder3/folder4/ > > /folder1/folder2/folder3/folder4/file.php > > > > Basically I am trying to setup as many security

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Ivo F.A.C. Fokkema
On Mon, 28 Aug 2006 09:47:02 +0100, Stut wrote: > Micky Hulse wrote: >> I am looking for the most secure/efficient way to compare these two >> strings: >> >> /folder1/folder2/folder3/folder4/ >> /folder1/folder2/folder3/folder4/file.php >> >> Basically I am trying to setup as many security featu

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread David Tulloh
Micky Hulse wrote: > Hi, > > I am looking for the most secure/efficient way to compare these two > strings: > > /folder1/folder2/folder3/folder4/ > /folder1/folder2/folder3/folder4/file.php > > Basically I am trying to setup as many security features as possible for > a simplistic (home-grown/ha

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Micky Hulse
Stut wrote: First of all make sure you are sending both strings through realpath (http://php.net/realpath) to remove any symbolic links and relative references. Then you can compare the two strings. The way you're doing it will work but it's probably not very efficient. This is what I use... $va

Re: [PHP] Comparing strings... need advice. :)

2006-08-28 Thread Stut
Micky Hulse wrote: > I am looking for the most secure/efficient way to compare these two > strings: > > /folder1/folder2/folder3/folder4/ > /folder1/folder2/folder3/folder4/file.php > > Basically I am trying to setup as many security features as possible for > a simplistic (home-grown/hand-coded)

[PHP] Comparing strings... need advice. :)

2006-08-27 Thread Micky Hulse
Hi, I am looking for the most secure/efficient way to compare these two strings: /folder1/folder2/folder3/folder4/ /folder1/folder2/folder3/folder4/file.php Basically I am trying to setup as many security features as possible for a simplistic (home-grown/hand-coded) CMS... This appears to wo

[PHP] Comparing Strings

2006-07-24 Thread Nils Holland
Hi folks, well, I have a really dumb question: I have the following script at http://www.tisys.org/misc/test.php: Now I call it like this: http://www.tisys.org/misc/test.php? license=0701770160811371731660412452242420381052542100071831272071031621 17160180165221170166096217228128 And in

RE: [PHP] comparing a string

2006-06-20 Thread yangshiqi1089
When the $_REQUEST['x'] is not 0 or '', it will be always correct condition of your if. see the magic*. -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 20, 2006 10:02 PM To: Ross; php-general@lists.php.net Subject: Re: [PHP] comparing a

Re: [PHP] comparing a string

2006-06-20 Thread tedd
At 12:43 PM +0100 6/20/06, Ross wrote: >I have a quiz where the ansers are held in a array called $correct answers. >When I compare the string > >if ($_REQUEST['x']= $correct_answers[$page-1]) { > > > >with a double == the answer is always correct with the single = it is always >wrong. > >when I e

[PHP] comparing strings - again!

2006-06-20 Thread Ross
if (isset($_POST['Submit'])) { //echo "post equals".$_POST['x']." corect is".$correct_answers[$page-1]; $compare1 = $_POST['x']; echo "page is".$page; $compare2 = $correct_answers[($page-1)]; echo "compare1 is ".$compare1; echo ""; echo "compare2 is ".$compare2; if (strcmp($compare1, $compare2

Re: [PHP] comparing a string

2006-06-20 Thread Larry Garfield
= is the assignment operator. It is not a comparison. == is the weak equality comparator. === is the strong equality comparator. On Tuesday 20 June 2006 06:43, Ross wrote: > I have a quiz where the ansers are held in a array called $correct answers. > When I compare the string > > if ($_REQUE

[PHP] comparing a string

2006-06-20 Thread Ross
I have a quiz where the ansers are held in a array called $correct answers. When I compare the string if ($_REQUEST['x']= $correct_answers[$page-1]) { with a double == the answer is always correct with the single = it is always wrong. when I echo out the posted answer and the value from the

Re: [PHP] Comparing of string

2006-01-04 Thread Raz
I would guess that the '&' in $_GET['formCheck'] will cause problems... Trying your code without the ampersand as in: $_GET['formCheck'] = 'ZL0X~TT4PQ%0~R0OXPRUHY7E!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S' It works just fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit

Re: [PHP] Comparing of string

2006-01-04 Thread Jeremy Privett
janbro wrote: Hi Jeremy, I tried if ( strcmp( trim($SollKombination), trim($formCheck) ) ) same negativ result. For some reason both strings are not considered to be the same. They have the same length, are of the same type and have the same content. Why PHP doesn't recognize them as beeing e

Re: [PHP] Comparing of string

2006-01-04 Thread janbro
Hi Jeremy, I tried if ( strcmp( trim($SollKombination), trim($formCheck) ) ) same negativ result. For some reason both strings are not considered to be the same. They have the same length, are of the same type and have the same content. Why PHP doesn't recognize them as beeing equal I don't

Re: [PHP] Comparing of string

2006-01-03 Thread Jeremy Privett
janbro wrote: Hello List I've got the following little code: $formCheck= $_GET['formCheck']; $SollKombination = $_SESSION['zufall']; echo "$SollKombination$formCheck"; print gettype($formCheck);

Re: [PHP] Comparing of string

2006-01-03 Thread janbro
., non-printing) characters, and > the like. > > Hope this helps. > > Jon > > > - Original Message - > From: "janbro" <[EMAIL PROTECTED]> > To: > Sent: Tuesday, January 03, 2006 11:22 PM >

Re: [PHP] Comparing of string

2006-01-03 Thread Jon Westcot
- Original Message - From: "janbro" <[EMAIL PROTECTED]> To: Sent: Tuesday, January 03, 2006 11:22 PM Subject: [PHP] Comparing of string > Hello List > > I've got the following little code: > > $formCheck= $_GET['formCheck&#

[PHP] Comparing of string

2006-01-03 Thread janbro
Hello List I've got the following little code: $formCheck= $_GET['formCheck']; $SollKombination = $_SESSION['zufall']; echo "$SollKombination$formCheck"; print gettype($formCheck);

Re: [PHP] comparing dates

2005-09-20 Thread Philip Hallstrom
Is there a quick way to compare dates in the format dd/mm/yy without exploding and comparing the individual parts? Compare them in what way? Before, after, days between? In any case, i'd look at strtotime() to convert them into timestamps, then diff them to get the number of seconds b/n them,

[PHP] comparing dates

2005-09-20 Thread Ross
Is there a quick way to compare dates in the format dd/mm/yy without exploding and comparing the individual parts? R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] comparing references

2005-09-02 Thread Stanislav Kuhn
Hi guys, quick question I need to find out if two different variables are pointing to same place... example: $var1 = &my_array; $var2 = &my_array; I need to do: if ($var1 === $var2) but I don't want to compare it by data, array is gonna be quite big and condition used in loop quite often. I n

Re: Re[2]: [PHP] comparing two texts

2005-06-24 Thread jenny mathew
> Today's newbie is tomorrow's Programmer. Some day > she'll maybe write that script she deemed impossible today, and contribute > it back to the community. > > Or maybe she'll some day add a PHP Module to interface directly to "diff" > somehow. Thanks Richard, for the motivation, and thanks to th

Re: Re[2]: [PHP] comparing two texts

2005-06-24 Thread Rory Browne
Folks There's no need to be quite so rude, when informing someone that you don't know of any existing PHP code(diff isn't written in PHP), that will fulfull their requirements. Jenny: Check out various PHP wikis. Most of them have a history feature, that allows you to compare current with previous

Re: Re[2]: [PHP] comparing two texts

2005-06-23 Thread Richard Lynch
On Thu, June 23, 2005 5:25 am, Tom Rogers said: > Hi, > > Thursday, June 23, 2005, 9:42:34 PM, you wrote: > . > . > . > > JM> whereas I'll happily spend an hour writing up and contemplating > someone > JM> else's problem - I don't have five minutes for people who are > expecting to be > JM> spoonfe

Re[2]: [PHP] comparing two texts

2005-06-23 Thread Tom Rogers
Hi, Thursday, June 23, 2005, 9:42:34 PM, you wrote: . . . JM> whereas I'll happily spend an hour writing up and contemplating someone JM> else's problem - I don't have five minutes for people who are expecting to be JM> spoonfed (go learn ASP and get a support contract, thanks ;-). Perhaps I mi

Re: [PHP] comparing two texts

2005-06-23 Thread Jochem Maas
Robert Cummings wrote: On Wed, 2005-06-22 at 22:55, Richard Lynch wrote: ... Well some noobs might think crude works quite well for them :) Ya want me to do Jenny's work for her for free or what?! :-) No but it seemed like Jenny did *grin*. _seemed_ ??? r u kidding :-) whereas I'l

Re: [PHP] comparing two texts

2005-06-22 Thread Robert Cummings
On Wed, 2005-06-22 at 22:55, Richard Lynch wrote: > On Sun, June 19, 2005 8:33 am, Robert Cummings said: > > On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote: > >> jenny mathew wrote: > >> >>Untested, very crude: >^^ > > > It's a bit of a dirty hack though. If I compare a 2

Re: [PHP] comparing two texts

2005-06-22 Thread Richard Lynch
On Sun, June 19, 2005 8:33 am, Robert Cummings said: > On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote: >> jenny mathew wrote: >> >>Untested, very crude: ^^ > It's a bit of a dirty hack though. If I compare a 2 character text > against a 40k text, the error handler will be

Re: [PHP] comparing two texts

2005-06-20 Thread JamesBenson
I saw a function in the php manual the other day which displays the difference as a percentage, for instance two strings, foo foos would be maybe 90% match, not sure thats what you mean though, you can always do a str_replace like so, $string1 = 'foo'; $string2 = 'foos'; $string = (str_re

Re: [PHP] comparing two texts

2005-06-20 Thread Jochem Maas
jenny mathew wrote: so,what what should i conclude .it is not possible to compare two texts and hight the difference at this moment. 1. conclude whatever the you like 2. 'hight' is not an english word (I guess you mean highlight) 3. actually it is possible but you have to write some code 4

Re: [PHP] comparing two texts

2005-06-19 Thread jenny mathew
so,what what should i conclude .it is not possible to compare two texts and hight the difference at this moment. thanks. Yours , Jenny On 6/19/05, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Sun, 2005-06-19 at 12:33, M. Sokolewicz wrote: > > Robert Cummings wrote: > > > On Sun, 2005-06-1

Re: [PHP] comparing two texts

2005-06-19 Thread Robert Cummings
On Sun, 2005-06-19 at 12:33, M. Sokolewicz wrote: > Robert Cummings wrote: > > On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote: > > > >>jenny mathew wrote: > >> > Untested, very crude: > > $maxlen = max(strlen($text1), strlen($text2)); > for ($i = 0; $i < $maxlen; $i++){ > >

Re: [PHP] comparing two texts

2005-06-19 Thread M. Sokolewicz
Robert Cummings wrote: On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote: jenny mathew wrote: Untested, very crude: $text1[$i]|$text2[$i]"; } ?> donot you think you program will just bring the server to its foot ,if the text message encountered is very large of order of 40 KB or larger.is

Re: [PHP] comparing two texts

2005-06-19 Thread Robert Cummings
On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote: > jenny mathew wrote: > >>Untested, very crude: > >> > >> >>$maxlen = max(strlen($text1), strlen($text2)); > >>for ($i = 0; $i < $maxlen; $i++){ > >>if (@$text1[$i] == @$text2[$i]) echo @$text1[$i]; > >>else @echo "$text1[$i]|$text2[$i]"; > >>} > >>

Re: [PHP] comparing two texts

2005-06-19 Thread M. Sokolewicz
jenny mathew wrote: Untested, very crude: $text1[$i]|$text2[$i]"; } ?> donot you think you program will just bring the server to its foot ,if the text message encountered is very large of order of 40 KB or larger.isthere any other efficient method. 40KB isn't large... now

Re: [PHP] comparing two texts

2005-06-19 Thread jenny mathew
> Untested, very crude: > > $maxlen = max(strlen($text1), strlen($text2)); > for ($i = 0; $i < $maxlen; $i++){ > if (@$text1[$i] == @$text2[$i]) echo @$text1[$i]; > else @echo "$text1[$i]|$text2[$i]"; > } > ?> donot you think you program will just bring the server to its foot ,if the text messa

Re: [PHP] comparing two texts

2005-06-18 Thread Edward Vermillion
On Jun 18, 2005, at 3:42 PM, Richard Lynch wrote: On Sat, June 18, 2005 3:21 am, jenny mathew said: is it possible to compare two different text messages and highlight the difference in php. i mean to say that $text1="message 1" $text2="message 2" i want to compare both $text1 and $text2 for d

Re: [PHP] comparing two texts

2005-06-18 Thread Richard Lynch
On Sat, June 18, 2005 3:21 am, jenny mathew said: > is it possible to compare two different text messages and highlight > the difference in php. > i mean to say that > $text1="message 1" > $text2="message 2" > i want to compare both $text1 and $text2 for differences and highlight > the differece in

Re: [PHP] comparing two texts

2005-06-18 Thread Richard Lynch
On Sat, June 18, 2005 9:41 am, jenny mathew said: > i want to compare two text fetched out of database and echo the result > on the webpage.i want to do it in php language and i donot want to > compare two text files ,i wanna compare two text messages (that is > fetched out from database). I belie

Re: [PHP] comparing two texts

2005-06-18 Thread jenny mathew
i want to compare two text fetched out of database and echo the result on the webpage.i want to do it in php language and i donot want to compare two text files ,i wanna compare two text messages (that is fetched out from database). thanks. Yours, Jenny. On 6/18/05, Jochem Maas <[EMAIL PROTECTED]>

  1   2   >