#23768 [Opn->Bgs]: Create an smart if that will return value of the parameter that matches expr

From: Date: Fri, 23 May 2003 07:10:13 +0000
Subject: #23768 [Opn->Bgs]: Create an smart if that will return value of the parameter that matches expr
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40248@lists.php.net to get a copy of this message
ID: 23768 Updated by: sniper@php.net Reported By: mno11 at lycos dot com -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Windows XP PHP Version: 4.3.1 New Comment: In almost every language there is ternary operator, also in PHP: http://www.php.net/manual/en/language.operators.comparison.php Previous Comments: ------------------------------------------------------------------------ [2003-05-22 23:32:42] mno11 at lycos dot com While using PHP and many other programming languages, I've come across having to use the following code a lot: if (strlen($form_fields[$i]) > $cur_max) $cur_max = strlen($form_fields[$i]); It would be great if PHP had a smart if_replace function implemented that will return the value of first parameter passed if expression is true and value of second parameter passed if expression is false. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23768&edit=1

« previous php.bugs (#40248) next »