note 128930 added to function.array-rand

From: Date: Thu, 05 Oct 2023 09:13:45 +0000
Subject: note 128930 added to function.array-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-220889@lists.php.net to get a copy of this message
array(2) { [0]=> array(5) { ["id"]=> int(22) ["user_id"]=> int(0) ["token_id"]=> int(7) ["wallet"]=> string(18) "xx_xx_xx" ["balance"]=> float(0) } [1]=> array(5) { ["id"]=> int(23) ["user_"]=> int(0) ["token_id"]=> int(7) ["wallet"]=> string(20) "xxxxxxxxxx_xx" ["balance"]=> float(0) } } // The above data comes from the database call $new_data = $ObjWallet->getDataFromDataBase($id); $key = array_rand($new_wallet, count($new_wallet)); // var_dump($new_wallet[$key[0]]['id']); if ($ObjWallet->saveUserWallet($new_wallet[$key[0]]['id'])) { // Done } ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 105.113.95.214) ---- Manual Page -- https://php.net/manual/en/function.array-rand.php Edit -- https://main.php.net/note/edit/128930 Del: integrated -- https://main.php.net/note/delete/128930/integrated Del: useless -- https://main.php.net/note/delete/128930/useless Del: bad code -- https://main.php.net/note/delete/128930/bad+code Del: spam -- https://main.php.net/note/delete/128930/spam Del: non-english -- https://main.php.net/note/delete/128930/non-english Del: in docs -- https://main.php.net/note/delete/128930/in+docs Del: other reasons-- https://main.php.net/note/delete/128930 Reject -- https://main.php.net/note/reject/128930 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220889) next »