note 88503 added to function.array-flip

From: Date: Tue, 27 Jan 2009 11:04:11 +0000
Subject: note 88503 added to function.array-flip
Groups: php.notes 
Request: Send a blank email to php-notes+get-149829@lists.php.net to get a copy of this message
corz at corz dot org: your function is really very funny, but classical way must be faster: <?php function getLongestValue($array) { $max=0; $longest=''; foreach($array as $value) { $len=strLen($value); if($len>$max) { $max=$len; $longest=$value; } } return $longest; } $array=array( 'input'=>'submit', 'textarea'=>'Some long spiel of text\r\na textarea, probably', 'another-input'=>'make me longer', 'and'=>'another', 'etc'=>'etc.', ); header('Content-Type: text/plain'); var_Dump(get_Longest_Value($array)); ?> Output: string(47) "Some long spiel of text\r\na textarea, probably" ---- Server IP: 212.24.129.51 Probable Submitter: 81.19.15.110 ---- Manual Page -- http://www.php.net/manual/en/function.array-flip.php Edit -- https://master.php.net/note/edit/88503 Del: integrated -- https://master.php.net/note/delete/88503/integrated Del: useless -- https://master.php.net/note/delete/88503/useless Del: bad code -- https://master.php.net/note/delete/88503/bad+code Del: spam -- https://master.php.net/note/delete/88503/spam Del: non-english -- https://master.php.net/note/delete/88503/non-english Del: in docs -- https://master.php.net/note/delete/88503/in+docs Del: other reasons-- https://master.php.net/note/delete/88503 Reject -- https://master.php.net/note/reject/88503 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149829) next »