note 84749 modified in function.strtolower by thiago

From: Date: Mon, 28 Jul 2008 16:12:23 +0000
Subject: note 84749 modified in function.strtolower by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142857@lists.php.net to get a copy of this message
Quick and works for accented characters like á Tested on linux and win apache+php5 <?php function strtolower2($s){ $ln = strlen($s); $ln1 = $ln -1; for($i=0; $i < $ln; $i++){ $k = ord(substr($s, $i, 1)); if($k>=65 && $k <= 90){ if($i > 0){ $l1 = substr($s, 0, $i); }else{ $l1 =''; } $l1 = $l1 . chr($k+32); if($i < $ln1){ $l1 = $l1 . substr($s, $i + 1); } $s = $l1; } } return $s; } ?> --was-- Quick and works for accented characters like á Tested on linux and win apache+php5 function strtolower2($s){ $ln = strlen($s); $ln1 = $ln -1; for($i=0; $i < $ln; $i++){ $k = ord(substr($s, $i, 1)); if($k>=65 && $k <= 90){ if($i > 0){ $l1 = substr($s, 0, $i); }else{ $l1 =''; } $l1 = $l1 . chr($k+32); if($i < $ln1){ $l1 = $l1 . substr($s, $i + 1); } $s = $l1; } } return $s; } http://php.net/manual/en/function.strtolower.php

« previous php.notes (#142857) next »