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,

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

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

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 ? > > How about this ? > > 8<

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

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: [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: [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: [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: [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: [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: [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: [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: [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: [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(

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)

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

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

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
Yep, they are of the same length. here they are: $SollKombination ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S $formCheck ZL0X~TT4PQ%0~R0OXPRUHY7E&!4~W337J71V4WDDI6$GS9480XP0TNP2I$1YX75S When creating the string on the form page only visible characters were allowed. thanks bu

Re: [PHP] Comparing of string

2006-01-03 Thread Jon Westcot
Hi JanBro: Quick guess: are the strings the same length? I've been bitten many times by string comparisons that appear to be identical but which fail due to trailing spaces, other "invisible" (i.e., non-printing) characters, and the like. Hope this helps. Jon - Original Me

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,

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]>

Re: [PHP] comparing two texts

2005-06-18 Thread Jochem Maas
jenny mathew wrote: hello group, 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 php.is it possible. yes.

Re: [PHP] comparing timestamps

2004-06-20 Thread Marek Kilimajer
Chris Mach wrote --- napísal:: I want to compare a timestamp in my database with the current time. I want to be able to tell if the timestamp is within 5 mins of the current time. How would I do this? Please? timestamp_column BETWEEN UNIX_TIMESTAMP(NOW() - INTERVAL 5 MINUTE) AND UNIX_TIMESTAMP(NO

Re: [PHP] Comparing 2 files

2004-03-20 Thread Raditha Dissanayake
You are reinventng the wheel try `diff file1 file2`; Jens Schmeiser wrote: Dear list. I want to compare two text files and print the differences. The text files contain the structure of a database, so they are very big (>6000 lines). The file looks like that: TABLENAME#COLUMNNAME#DATATYPE#DATALEN

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-02-03 Thread Jason Wong
On Wednesday 04 February 2004 00:09, Chris Bruce wrote: > I have modified your line { $email_list .= "'{$row['email']}',"; }, > with { $email_list .= str_replace("'", "\'", "'{$r[email]}',"); }, but > now it escapes all the single quotes. Is there a php function that > escapes single quotes in Mys

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-02-03 Thread John W. Holmes
From: Chris Bruce > Is there a php function that escapes single quotes > in Mysql queries? addslashes() mysql_escape_string() mysql_real_escape_string() ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-02-03 Thread Chris Bruce
HI John, I have this working with the exception of when there is a ' in an email address that I want to remove. I have modified your line { $email_list .= "'{$row['email']}',"; }, with { $email_list .= str_replace("'", "\'", "'{$r[email]}',"); }, but now it escapes all the single quotes. Is th

Re: [PHP] comparing dates

2004-02-01 Thread Ryan A
have the user comments. Cheers, -Ryan http://Bestwebhosters.com - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Ryan A" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 1:21 AM Subject: Re: [PHP] com

Re: [PHP] comparing dates

2004-02-01 Thread Justin French
On Monday, February 2, 2004, at 10:04 AM, Ryan A wrote: which gives me two 14 numberic characters strings like: 20040202091212 20040201070500 How do I compare it to display something like this to the visitor: You have $xdays day/s, $xhours hours and $xmins minutes before your account expires Be

RE: [PHP] comparing dates

2004-02-01 Thread Martin Towell
Is it possible to pull that dates out as unix time stamps? Then all you need to do is subtract one from the other, convert the results to days/hours/minutes and Bob's your uncle. If not, then you'll need to do some string manipulation to get the string into a format that strtotime() understands a

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Raditha Dissanayake
Did you mention cofee John? now why did i suggest subselects when good old joins seem to do the tricks. Yikes! John W. Holmes wrote: From: "Chris Bruce" <[EMAIL PROTECTED]> I am trying to write a function that would compare one table to a number of other tables in Mysql and remove any duplic

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
Cool, thanks John, I'll give it a shot. Sorry for the last email, I sent it before you sent this one :) -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 On Jan 30, 2004, at 12:54 PM, John W. Holmes wr

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
This will work for Mysql 3.23.54? -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilmar Cres. Mississauga, ON L5L4B2 CA 905.828.9189 On Jan 30, 2004, at 12:48 PM, John W. Holmes wrote: From: "Chris Bruce" <[EMAIL PROTECTED]> I am trying to write a fu

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread John W. Holmes
From: "Chris Bruce" <[EMAIL PROTECTED]> > Mysql 3.23.54. > > My first thought was to load the output from the tables into an array > and they use a foreach and in_array to create a list of dups, but I > wanted to see if there was an easier way. Ah, in that case, my other query won't work. :) Thi

RE: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Mike Brum
>My first thought was to load the output from the tables into an array and they use a foreach and >in_array to create a list of dups, but I wanted to see if there was an easier way. -- If you're not using MySQL >4, then yeah, that's probably the best way. Just realize that this isn't going to

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread John W. Holmes
From: "Chris Bruce" <[EMAIL PROTECTED]> > I am trying to write a function that would compare one table to a > number of other tables in Mysql and remove any duplicates found. This > is for tables of email addresses where I want to remove any dups found. > > Example: > Master list - compare to list

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Chris Bruce
Mysql 3.23.54. My first thought was to load the output from the tables into an array and they use a foreach and in_array to create a list of dups, but I wanted to see if there was an easier way. -- Chris Bruce [EMAIL PROTECTED] Idextrus E-Business Architects http://www.idextrus.com 3282 Wilm

Re: [PHP] Comparing multiple Mysql tables to find duplicates

2004-01-30 Thread Raditha Dissanayake
Hi, If you are using mysql 4 you can use subselects to delete from where in (select) the select itself can be a multi table join. if you are on mysql 3.xx you can use PHP to mimic a subselect. Chris Bruce wrote: Hello everyone, I am trying to write a function that would compare one table t

Re: [PHP] Comparing 2 strings.

2003-11-19 Thread Ed Curtis
I guess I did miss that it says that the comparison is case sensitive and binary safe. Thanks, Ed On Wed, 19 Nov 2003, CPT John W. Holmes wrote: > From: "Ed Curtis" <[EMAIL PROTECTED]> > > > I currently store text from a MySQL blob field in a string $orig_text. I > > need to compare that wi

Re: [PHP] Comparing 2 strings.

2003-11-19 Thread CPT John W. Holmes
From: "Ed Curtis" <[EMAIL PROTECTED]> > I currently store text from a MySQL blob field in a string $orig_text. I > need to compare that with something someone type in from a form stored in > $new_text. How would I go about comparing them to see if they are > different or exactly the same? strcmp

Re: [PHP] comparing xml files, removing some html tags

2003-08-20 Thread [EMAIL PROTECTED]
Hi, Discussion of xerces will take us out of the mandate of this list. Please download xerces from http://xml.apache.org along with the documents and you will see plenty of sample codes. You might also want to look at IBM's developer site (IBM created the bulk of xerces) all the best raditha Ro

Re: [PHP] comparing xml files, removing some html tags

2003-08-20 Thread Robert Mena
Thanks to all (actually just one) that answered my question. Unfortunatelly I was hoping a more "complete" answer since the part I asked was not the main goal... bu t anyway... I'd like to ask then if the viewers could validate my new approach or at least point ways of actually implementing it.

Re: [PHP] comparing two arrays

2003-07-02 Thread Shena Delian O'Brien
Michael A Smith wrote: Look at array_diff() (http://php.net/array_diff). That ought to do what you want. Yes! Thank you :) -Michael On Wed, 2003-07-02 at 10:15, Shena Delian O'Brien wrote: Hi - I have two arrays that need to be compared. I need to know if their values match or not. Currently I

Re: [PHP] Comparing Data

2002-08-13 Thread Michael Sims
On Tue, 13 Aug 2002 21:31:22 -0400, you wrote: >Well, the only problem is, the data will be outputted into a dropdown box, so a loop >would cause duplicates of the ID. > >Guess I should have mentioned that there are approx 50 ID's and they are not unique. >The only way I can think of doing it

RE: [PHP] Comparing Data

2002-08-13 Thread Justin
Well, the only problem is, the data will be outputted into a dropdown box, so a loop would cause duplicates of the ID. Guess I should have mentioned that there are approx 50 ID's and they are not unique. The only way I can think of doing it is something like: $foo = mysql_query($whatever) wh

RE: [PHP] Comparing Data

2002-08-13 Thread Peter Houchin
> -Original Message- > From: Justin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 14 August 2002 10:52 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Comparing Data > > > Hello all, > > I've run into a problem and there has got to be a way to do this. > > I'm searching a mysql table an

Re: [PHP] comparing a variable to value in DB

2002-07-29 Thread Kevin Stone
No trust me you're on the right track. You don't need the double == operator in the SQL query. Try something like this... $query = "SELECT * FROM membersWHERE username = '$username'"; $result = mysql_query($query, $db); if (mysql_num_rows($result) == 0) { echo "The username $username does n

RE: [PHP] comparing strings does not work

2002-06-11 Thread Jonathan Rosenberg
strcmp returns 0 if the two strings are equal. In any case, why not just do if ($city == $city_new) $error = true; > -Original Message- > From: andy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 9:10 AM > To: [EMAIL PROTECTED] > Subject: [PHP] comparing strings does

  1   2   >