note 128299 added to language.variables.variable

From: Date: Thu, 09 Mar 2023 16:11:50 +0000
Subject: note 128299 added to language.variables.variable
Groups: php.notes 
Request: Send a blank email to php-notes+get-220256@lists.php.net to get a copy of this message
So, this is very useful for returning specific variables within a function or class. <?php class GetThe{ public static function value($variable){ $var1 = 'Variable 1 value'; $var2 = 'Variable 2 value'; $var3 = 'Variable 3 value'; $var4 = 'Variable 4 value'; $var5 = 'Variable 5 value'; return $$variable; } } GetThe::value('var1'); // returns string 'Variable 1 value' GetThe::value('var4'); // returns string 'Variable 4 value' ?> ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 181.4.178.200) ---- Manual Page -- https://php.net/manual/en/language.variables.variable.php Edit -- https://main.php.net/note/edit/128299 Del: integrated -- https://main.php.net/note/delete/128299/integrated Del: useless -- https://main.php.net/note/delete/128299/useless Del: bad code -- https://main.php.net/note/delete/128299/bad+code Del: spam -- https://main.php.net/note/delete/128299/spam Del: non-english -- https://main.php.net/note/delete/128299/non-english Del: in docs -- https://main.php.net/note/delete/128299/in+docs Del: other reasons-- https://main.php.net/note/delete/128299 Reject -- https://main.php.net/note/reject/128299 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220256) next »