note 127185 added to function.array-fill-keys

From: Date: Mon, 20 Jun 2022 11:32:53 +0000
Subject: note 127185 added to function.array-fill-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-218601@lists.php.net to get a copy of this message
see array_fill_keys are basically used to make a new array from a pre-existing array in a form that the value of the pre-existing array will now be the key of the new Array .And there value will be same That we had given in the 2nd parameter . Example Below---->>> <?php //pre existing array $a = array("a","b","c","d","e"); //new array with a single same value $newArray = array_fill_keys($a, "Testing"); //printing the array echo "<pre>"; print_r($newArray); echo "</pre>"; ?> output; Array ( [a] => Testing [b] => Testing [c] => Testing [d] => Testing [e] => Testing ) ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.12.131 (proxied: 122.161.53.63) ---- Manual Page -- https://php.net/manual/en/function.array-fill-keys.php Edit -- https://main.php.net/note/edit/127185 Del: integrated -- https://main.php.net/note/delete/127185/integrated Del: useless -- https://main.php.net/note/delete/127185/useless Del: bad code -- https://main.php.net/note/delete/127185/bad+code Del: spam -- https://main.php.net/note/delete/127185/spam Del: non-english -- https://main.php.net/note/delete/127185/non-english Del: in docs -- https://main.php.net/note/delete/127185/in+docs Del: other reasons-- https://main.php.net/note/delete/127185 Reject -- https://main.php.net/note/reject/127185 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#218601) next »