note 66174 added to function.constant

From: Date: Tue, 16 May 2006 17:00:57 +0000
Subject: note 66174 added to function.constant
Groups: php.notes 
Request: Send a blank email to php-notes+get-111391@lists.php.net to get a copy of this message
It's easily to user constant() and define() to translate some words from your database-saves. For example: You have a table userprofil and one coloumn is "gender". Gender can be male or female but you will display "maennlich" or "weiblich" (german words for it - whatever...) First step: Fetch into $Gender Second: define("male", "maennlich"); define("female", "weiblich"); Third: echo constant($Gender); Now, the index of the variable $Gender will be handled like a constant! (It works like "echo male;" for better understanding) And a result of this, it displays maennlich btw. weiblich! greetz ---- Server IP: 217.160.72.57 Probable Submitter: 84.132.246.217 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.constant.php Edit -- http://master.php.net/note/edit/66174 Del: integrated -- http://master.php.net/note/delete/66174/integrated Del: useless -- http://master.php.net/note/delete/66174/useless Del: bad code -- http://master.php.net/note/delete/66174/bad+code Del: spam -- http://master.php.net/note/delete/66174/spam Del: non-english -- http://master.php.net/note/delete/66174/non-english Del: in docs -- http://master.php.net/note/delete/66174/in+docs Del: other reasons-- http://master.php.net/note/delete/66174 Reject -- http://master.php.net/note/reject/66174 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#111391) next »