note 129246 added to function.oci-bind-by-name

From: Date: Wed, 14 Feb 2024 15:58:32 +0000
Subject: note 129246 added to function.oci-bind-by-name
Groups: php.notes 
Request: Send a blank email to php-notes+get-221198@lists.php.net to get a copy of this message
The note about the PHP var argument being a reference and some kinds of loops not working is very important here. However, you can make a foreach loop work if you create a reference to the value, use that in the bind and then unset the reference. For example: <?php foreach ($myarray as $key => $val) { $value =& $val; oci_bind_by_name($stid, $key, $val); unset($value); } ?> This binds each key to the location of $value, but $value is a reference to the original content of $val when you unset it after binding, it can be set and used again. https://www.php.net/manual/en/language.references.unset.php ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.131 (proxied: 129.57.130.40) ---- Manual Page -- https://php.net/manual/en/function.oci-bind-by-name.php Edit -- https://main.php.net/note/edit/129246 Del: integrated -- https://main.php.net/note/delete/129246/integrated Del: useless -- https://main.php.net/note/delete/129246/useless Del: bad code -- https://main.php.net/note/delete/129246/bad+code Del: spam -- https://main.php.net/note/delete/129246/spam Del: non-english -- https://main.php.net/note/delete/129246/non-english Del: in docs -- https://main.php.net/note/delete/129246/in+docs Del: other reasons-- https://main.php.net/note/delete/129246 Reject -- https://main.php.net/note/reject/129246 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221198) next »