php-general Digest 18 Jun 2005 13:09:47 -0000 Issue 3519
php-general Digest 18 Jun 2005 13:09:47 - Issue 3519 Topics (messages 217164 through 217171): Re: possible jscript/php/frames question!! 217164 by: Chris W. Parker 217166 by: Tom Rogers Re: Problems with header() 217165 by: Tom Rogers 217171 by: Martn Marqus Re: your script: Telling human and machines apart 217167 by: Burhan Khalid comparing two texts 217168 by: jenny mathew rename 217169 by: Mister Jack 217170 by: Bob Winter Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- bruce mailto:[EMAIL PROTECTED] on Friday, June 17, 2005 5:05 PM said: chris... i'll humour you.. although i'm pretty sure you have no idea as to what i'm trying to acomplish.. or how to get to my goal... the basic issue is to allow a user to click inside an image map, and to translate the coordinates to something else, prior to sending the information back to the server.. Ooohh... the solution to this appears to need to be a combination of jscript/php... thus the posting... Actually it doesn't appear to be a mixture at all... It is solely the... responsibility of javascript (or another client... side technology) to do the transmalating... you speak of. PHP is completely... out... of the... loop. ... [snip/] so i waste another 30 secs dealing with some clueless person... Come back when... you have a PHP question... and we can chat... Chris. ---End Message--- ---BeginMessage--- Hi, Saturday, June 18, 2005, 8:47:58 AM, you wrote: b hi... b i've got a problem where i'm trying to play with imagemaps. i created a test b image map, but when i select inside the image map, i 'see' the ?x,y from b the imagemap, appended to the url in the browser address bar... i get b http://foo.com?3,5 etc... b is there a way to prevent this from occuring?? b i'd like to be able to select the imagemap, get the coordinate, and not have b the x,y mouse coordinate show up in the address bar... b i thought i could use an onClick, and go to a javascript function, but i b couldn't figure out how to get the mouse coordinates within the jscript b function. b if i slammed all this inside a frame, would that prevent the url-x,y b information from being displayed?? b my sample code is below... b thanks b -bruce b [EMAIL PROTECTED] b b --- b [EMAIL PROTECTED] site]# cat map.php b ? b /* b test for image maps... b */ ? b ? b $_self = $_SERVER['PHP_SELF']; ? b html b body b script language=javascript type=text/javascript b !-- b function foo1(q) b { b // str = window.location.search b // document.write(fff +q+br); b // location.href=map.php; b // return true; b } b function foo(e) b { b //q = q+1; b mX = event.clientX; b mY = event.clientY; b // str = window.location.search bdocument.write(fff +mX+ y= +mY+br); b location.href=map.php; b return true; b } // -- b /script b !-- b centera href=?=$_self;?img -- b center b !-- b a href=?=$_self;? onclick =alert(self.location.search); return false -- b a href=ff.php onclick= b img src=imagemap.gif ISMAP/a/center b p b script language=javascript type=text/javascript b !-- b str = location.search b if(str) b { bdocument.write(fff +str+br); b//location.href=map.php; b } // -- b /script b /body b /html A PHP solution to your problem is to save the x y co-ordinates in a session and do a refresh, then get the values fom session. Do something like ?php session_start(); if(isset($_SESSION['x']) isset($_SESSION['y'])){ //do your thing here unset($_SESSION['x']; unset($_SESSION['y']; }else{ //get x and y from request variables here if($x $y){ $_SESSION['x'] = $x; $_SESSION['y'] = $y; header('location: '.$_SERVER['PHP_SELF']); exit; }else{ //show start page } } -- regards, Tom ---End Message--- ---BeginMessage--- Hi, Saturday, June 18, 2005, 7:55:10 AM, you wrote: MM I have to send a PDF file after a submit on a form. The PDF is well created, MM and I'm sending it to the client with this: MM $fpdfName = /tmp/ . session_id() . .pdf; MM // Vamos a mandar el PDF MM header('Content-type: application/pdf'); MM // El archivo se va a llamar libreDeuda.pdf MM header('Content-Disposition: attachment; filename=libreDeuda' . MM'.pdf'); MM // El PDF fuente va a ser $ftexName. MM readfile($fpdfName); MM The problem is that the PDF file that is sent is corrupted for acroread (xpdf MM reads it like a charme), because, after the end of file (%%EOF) of PDF there MM is an HTML page add to the file. MM Is there anyway I can solve this? Is the sintaxis I used for sending a file MM correct? Here is a script I use to send pdfs which
[PHP] Re: your script: Telling human and machines apart
Merlin wrote: Hi Burhan, you posted a while ago to the php user group: This is an example of what my script outputs : http://meidomus.com/code/captcha/ Source available if you are interested. I would be interested to try that code and alter it to fit my needs. Would that be possible? Merlin : Sure. A lot of people have requested this, so I'm going to post it online for all to see. I think I found this script (or a version of it) online somewhere and modified it. I can't remember where exactly. Anyway, I have posted the script's source at http://meidomus.com/code/captcha/captcha.phps The font used in the script is available at http://meidomus.com/code/captcha/bboron.ttf You can use any other font, provided you change the $font variable in the script. The script sets a session variable turing_string with the text of the image (this is what you compare the user's input with). The script is not very complex, and has a few comments. Let me know if you have any other questions. Warmly, Burhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] comparing two texts
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. waiting for your reply. thanks. Yours, Jenny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rename
Hi, I would like to know precisely what rename do in case of error. any link for that ? I do a : @rename($old, $new), what happens if I run out of space ? is the rename just an alias for C function library ? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: rename
Look at http://us2.php.net/manual/en/function.rename.php Mister Jack wrote: Hi, I would like to know precisely what rename do in case of error. any link for that ? I do a : @rename($old, $new), what happens if I run out of space ? is the rename just an alias for C function library ? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with header()
El Sb 18 Jun 2005 01:38, Tom Rogers escribi: Here is a script I use to send pdfs which also handles caching information. It may just be you are missing the content-length header? [snip] header(Accept-Ranges: bytes); header('Cache-Control: no-cache, must-revalidate'); header(Content-type: application/pdf); header(Content-Length: $len); readfile($filename); Excelent! The Content-length did it. The only thing I don't understand is that whenever I put the header(Accept-Ranges: bytes) it stops sending the PDF file. I comment out that line and everything works like a charme. Thank you! -- 10:06:43 up 11 days, 21:53, 1 user, load average: 2.32, 1.81, 1.35 - Martn Marqus| select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SFTP problems
I need to use SFTP to send text files and binary files from one server to another, but I'm unable to use fopen on the remote server, and if I send with ssh2_scp_send the files are truncated. I'm assuming the libssh2-PECL/ssh2 installation isn't the problem because I'm able to connect using ssh2_auth_password, create a directory on the remote server with ssh2_sftp_mkdir, and copy files with ssh2_sftp_send and ssh2_sftp_recv (even though ssh2_sftp_send truncates files). When I try to use fopen, I get this error message: Warning: fopen(): Unable to open ssh2.sftp://Resource id #10/whatever.com:22/home/whatever/public_html/flamingo/test.txt on remote host in /home/user/public_html/cms/sftp_test.php on line 79 Warning: fopen(ssh2.sftp://Resource id #10/whatever.com:22/home/whatever/public_html/flamingo/test.txt): failed to open stream: Resource temporarily unavailable in /home/user/public_html/cms/sftp_test.php on line 79 Here's line 79 of sftp_test.php: $stream = fopen(ssh2.sftp://$sftp/whatever.com:22/home/whatever/public_html/ flamingo/.$filename, wt) I've read Secure Communications with PHP and SSH in the February PHP Architect. That's what prompted me to try PECL/ssh2, but now I'm stuck. Anybody successfully using fopen with SFTP or anybody using ssh2_sftp_send without getting truncated files? -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing two texts
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. is it easy? that depends on how far you want to go with diff'ing (and how good you are at string manipulation :-) this is a general problem which has been solved by very skilled people already, I would suggest reading some more about 'diff' etc and figure out if you can use existing tools to get what you want: http://www.gnu.org/software/diffutils/diffutils.html http://en.wikipedia.org/wiki/Diff waiting for your reply. thanks. Yours, Jenny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing two texts
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] wrote: 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. is it easy? that depends on how far you want to go with diff'ing (and how good you are at string manipulation :-) this is a general problem which has been solved by very skilled people already, I would suggest reading some more about 'diff' etc and figure out if you can use existing tools to get what you want: http://www.gnu.org/software/diffutils/diffutils.html http://en.wikipedia.org/wiki/Diff waiting for your reply. thanks. Yours, Jenny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SFTP problem
I need to use SFTP to send text files and binary files from one server to another, but I'm unable to use fopen on the remote server, and if I send with ssh2_scp_send the files are truncated. I'm assuming the libssh2-PECL/ssh2 installation isn't the problem because I'm able to connect using ssh2_auth_password, create a directory on the remote server with ssh2_sftp_mkdir, and copy files with ssh2_sftp_send and ssh2_sftp_recv (even though ssh2_sftp_send truncates files). When I try to use fopen, I get this error message: Warning: fopen(): Unable to open ssh2.sftp://Resource id #10/whatever.com:22/home/whatever/public_html/flamingo/test.txt on remote host in /home/user/public_html/cms/sftp_test.php on line 79 Warning: fopen(ssh2.sftp://Resource id #10/whatever.com:22/home/whatever/public_html/flamingo/test.txt): failed to open stream: Resource temporarily unavailable in /home/user/public_html/cms/sftp_test.php on line 79 Here's line 79 of sftp_test.php: $stream = fopen(ssh2.sftp://$sftp/whatever.com:22/home/whatever/public_html/ flamingo/.$filename, wt) I've read Secure Communications with PHP and SSH in the February PHP Architect. That's what prompted me to try PECL/ssh2, but now I'm stuck. Anybody successfully using fopen with SFTP or anybody using ssh2_sftp_send without getting truncated files? -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] asterix for arrray_search?
Hi there, I am trying to find out how to match a search on : 5a or 5b with array search. Basicly I would like to make it true as soon as the function finds a value starting with 5. As for now I have: if (array_search('5a', $emsg) OR array_search('5b', $emsg)){ ... that statement will get very long till z :-) Any ideas how to make something like this: array_search('5*', $emsg) Thank you for any hint, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] asterix for arrray_search?
As for now I have: if (array_search('5a', $emsg) OR array_search('5b', $emsg)){ ... that statement will get very long till z :-) Any ideas how to make something like this: array_search('5*', $emsg) How about something like: search($emsg) { for($i = 0; $i count($emsg); $i++) if(preg_match('/5[a-z]/', $emsg[$i])) return $i; return -1; } Regards, Yasir -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Merging Duplicate array items
Hello, I've been trying to figure out on how I could evaluated this array and combine like items... here is the array.. it represents a shopping cart contents.. you'll notice that the first array is the same as the third... what I am trying to do is combine the quantity of the first array and the third... I am not asking from someone to program this for me... just for someone to give me a heads up on if there is a array function I could use. Thanks for any help! - array example $ARY_cart[] = array('product_id' = '123', 'sku' = 'DFBag-12', 'quantity' = '2', 'product_name' = 'Dog Food', 'unit' = '12 lbs. Bag', 'price' = '12.05' ); $ARY_cart[] = array('product_id' = '224', 'sku' = 'cFBag-6', 'quantity' = '1', 'product_name' = 'Cat Food', 'unit' = '8 lbs. Bag', 'price' = '4.25' ); $ARY_cart[] = array('product_id' = '123', 'sku' = 'DFBag-12', 'quantity' = '24', 'product_name' = 'Dog Food', 'unit' = '12 lbs. Bag', 'price' = '12.05' ); -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: rename
Hi, That's what I've done, but I does not say clearly _when_ @rename should failed. I've read the documentation in the C library for Unix, and it says that it failed when it can't _add_ an entry to the directory. What I observe is an empty file... still weird, I'll look depper into it. (since i've been bitten by it with my website being 'blank page' since it grew out of space...) Thanks, On 6/18/05, Bob Winter [EMAIL PROTECTED] wrote: Look at http://us2.php.net/manual/en/function.rename.php Mister Jack wrote: Hi, I would like to know precisely what rename do in case of error. any link for that ? I do a : @rename($old, $new), what happens if I run out of space ? is the rename just an alias for C function library ? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [SOLVED] Merging Duplicate array items
I think I solved the issue i was having... I would be willing for any optimization though.. .here is what I did - code - $ARY_cart[] = array('product_id' = '123', 'sku' = 'DFBag-12', 'quantity' = '2', 'product_name' = 'Dog Food', 'unit' = '12 lbs. Bag', 'price' = '12.05' ); $ARY_cart[] = array('product_id' = '224', 'sku' = 'cFBag-6', 'quantity' = '1', 'product_name' = 'Cat Food', 'unit' = '8 lbs. Bag', 'price' = '4.25' ); $ARY_cart[] = array('product_id' = '123', 'sku' = 'DFBag-12', 'quantity' = '24', 'product_name' = 'Dog Food', 'unit' = '12 lbs. Bag', 'price' = '12.05' ); $cart_count = 0; $cart_total = count($ARY_cart); foreach ($ARY_cart as $key = $ary_value) { do{ if($ary_value['product_id'] == $ARY_cart[$cart_count]['product_id'] $key $cart_count) { $ARY_cart[$cart_count]['quantity'] = $ARY_cart[$cart_count]['quantity'] + $ARY_cart[$key]['quantity']; unset($ARY_cart[$key]); } $cart_count++; } while ($cart_count == $cart_total); $cart_count = 0; } On 6/18/05, Joe Harman [EMAIL PROTECTED] wrote: Hello, I've been trying to figure out on how I could evaluated this array and combine like items... here is the array.. it represents a shopping cart contents.. you'll notice that the first array is the same as the third... what I am trying to do is combine the quantity of the first array and the third... I am not asking from someone to program this for me... just for someone to give me a heads up on if there is a array function I could use. Thanks for any help! - array example $ARY_cart[] = array('product_id' = '123', 'sku' = 'DFBag-12', 'quantity' = '2', 'product_name' = 'Dog Food', 'unit' = '12 lbs. Bag', 'price' = '12.05' ); $ARY_cart[] = array('product_id' = '224', 'sku' = 'cFBag-6', 'quantity' = '1', 'product_name' = 'Cat Food', 'unit' = '8 lbs. Bag', 'price' = '4.25' ); $ARY_cart[] = array('product_id' = '123', 'sku' = 'DFBag-12', 'quantity' = '24', 'product_name' = 'Dog Food', 'unit' = '12 lbs. Bag', 'price' = '12.05' ); -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] asterix for arrray_search?
On Sat, June 18, 2005 10:11 am, Merlin said: I am trying to find out how to match a search on : 5a or 5b with array search. Basicly I would like to make it true as soon as the function finds a value starting with 5. As for now I have: if (array_search('5a', $emsg) OR array_search('5b', $emsg)){ ... that statement will get very long till z :-) Any ideas how to make something like this: array_search('5*', $emsg) I believe that in recent versions of PHP, the preg_* functions will accept an array as an argument... Or maybe I dreamed that. You should benchmark the solutions and also consider just using implode() on the array to make a giant string and search that. Depending on a lot of factors, any of these could out-perform the others. Try it with data as close to real-world as you can get. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing two texts
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 believe you will find it more feasible to throw your two messages into files and use exec() to call diff on them than to write essentially all of diff in PHP... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rename
On Sat, June 18, 2005 3:50 am, Mister Jack said: I would like to know precisely what rename do in case of error. any link for that ? It will probably return 0 (or maybe -1) on error. It may or may not also fill in $php_errmessage (?) or whatever the variable is called. It should be documented at http://php.net/rename what error codes it returns. If not, you could run some tests fairly easily. I do a : @rename($old, $new), what happens if I run out of space ? It won't work, and you have suppressed the error message, so you won't even know it didn't work. Using @ like that is just a Bad Idea. You need to write better software that handles error conditions and does something reasonable about them. ? is the rename just an alias for C function library ? Pretty much, but not to the point that it blindly returns whatever the C 'rename' returns, probably. You could read the PHP source and find out :-) http://cvs.php.net -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing two texts
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 php.is it possible. waiting for your reply. Untested, very crude: ?php $maxlen = max(strlen($text1), strlen($text2)); for ($i = 0; $i $maxlen; $i++){ if (@$text1[$i] == @$text2[$i]) echo @$text1[$i]; else @echo font color=red$text1[$i]|$text2[$i]/font; } ? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possible jscript/php/frames question!!
On Fri, June 17, 2005 3:47 pm, bruce said: i've got a problem where i'm trying to play with imagemaps. i created a test image map, but when i select inside the image map, i 'see' the ?x,y from the imagemap, appended to the url in the browser address bar... i get http://foo.com?3,5 etc... is there a way to prevent this from occuring?? Sure. Change your LINK to a FORM with an INPUT TYPE=image and use METHOD=POST on the FORM tag. form method=postinput type=image name=clicked src=images/clicker.jpg/form ?php if (isset($clicked_x)){ echo ($clicked_x, $clicked_y)br /; } ? I dunno why everybody else gave you such complicated answers. It's still not a PHP question, though, except it's confusing PHP changes .x and .y into _x and _y on the variable names because . is not valid in variable names. :-) There, that made this post on-topic. Sort of. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting object props
On Fri, June 17, 2005 2:48 pm, D_C said: is there a way to sort the properties of an object by their name, much like sort works on arrays? i am getting back an object from a database query and want to list the resulting items in alpha order by field name... http://php.net/ksort Last time I checked, PHP would still convert an object to an array if you forced it to... If not, there are introspective functions to examine your object and all its properties, and surely you could build the array yourself and then ksort it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passthru() passing variables
On Fri, June 17, 2005 6:47 am, Jason Barnett said: What is a reliable cross-platform way of showing which user PHP is running as? http://php.net/get_current_user The bogus User Contributed note about REMOTE_USER is, well, bogus, almost for sure. If that fails, I guess you could try: ?php ob_start(); phpinfo(); $phpinfo = ob_endclean(); ? Then you have to dig out the PHP User from that. It's possible there is a PHP Constant here that is the User: http://php.net/manual/en/language.constants.predefined.php If none of those work, I'm guessing even Windoze has something like whoami so you could http://php.net/exec whoami or its equivalent, based on the http://php.net/php_sapi_name If all that fails, I'd just give up. :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Using Exec Function
On Fri, June 17, 2005 5:50 am, Davide Pasqualini said: I did as You suggested: ?php $win_cmd = \C:\\Hello.exe\; exec($win_cmd, $stdout, $stderr); print Standard output:\n; print_r($stdout); print Standard error:\n; print_r($stderr); ? but Hello.Exe, a very simple program, doesn't run and my browser seems waiting something from the server. Can I run a program (exe file) in another way ? If you've got the Hello.exe running, but not returning, you could *MAYBE* do : ?php exec(Hello.exe , $output, $error);? The will put it into the background, even in Windoze, I think... If not, figure out how Windows starts background tasks, and do that. Or make Hello.exe actually be a tiny little program that forks off the program you really want to use, and then returns. Or... Lots of ways to try to force the OS to fork the process. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] comparing two texts
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 differences and highlight the differece in php.is it possible. waiting for your reply. Untested, very crude: ?php $maxlen = max(strlen($text1), strlen($text2)); for ($i = 0; $i $maxlen; $i++){ if (@$text1[$i] == @$text2[$i]) echo @$text1[$i]; else @echo font color=red$text1[$i]|$text2[$i]/font; } ? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Would it be possible to explode both messages oninto an array and run array_diff() and work from there? Just a thought late in the day... Edward Vermillion [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php