note 94775 added to function.strcmp

From: Date: Tue, 24 Nov 2009 14:26:54 +0000
Subject: note 94775 added to function.strcmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-163223@lists.php.net to get a copy of this message
You may find this useful: <?php function vistrcmp($s1, $s2){ if(strlen($s2)>strlen($s1)){ $t=$s1;$s1=$s2;$s2=$t; } for($i=0;$i<strlen($s2);$i++){ if($s1[$i]!=$s2[$i])$ret.='.'; else $ret.=' '; } $ret.=str_repeat('/', strlen($s1)-strlen($s2)); return $ret; } $old = 'My old string'; $new = 'My new string number two'; $diff = mystrcmp($old, $new); printf("<pre>OLD: %s\nNEW: %s\nDIFF:%s\n</pre>", $old, $new, $diff); /* Should show: OLD: My old string NEW: My new string number two DIFF: ... /////////// */ ?> ---- Server IP: 69.147.83.197 Probable Submitter: 89.171.26.244 ---- Manual Page -- http://www.php.net/manual/en/function.strcmp.php Edit -- https://master.php.net/note/edit/94775 Del: integrated -- https://master.php.net/note/delete/94775/integrated Del: useless -- https://master.php.net/note/delete/94775/useless Del: bad code -- https://master.php.net/note/delete/94775/bad+code Del: spam -- https://master.php.net/note/delete/94775/spam Del: non-english -- https://master.php.net/note/delete/94775/non-english Del: in docs -- https://master.php.net/note/delete/94775/in+docs Del: other reasons-- https://master.php.net/note/delete/94775 Reject -- https://master.php.net/note/reject/94775 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163223) next »