note 126865 added to function.preg-replace-callback

From: Date: Mon, 21 Feb 2022 01:36:18 +0000
Subject: note 126865 added to function.preg-replace-callback
Groups: php.notes 
Request: Send a blank email to php-notes+get-217634@lists.php.net to get a copy of this message
Note that when using the 'Use ($variable)' with preg_replace_callback, if you wish the value to be altered by the anonymous function, you must pass the value in by reference. eg preg_replace_callback($pattern, function($matches) use (&$alterThis) { $alterThis+=$something;},$string); ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.135 (proxied: 146.70.27.60) ---- Manual Page -- https://php.net/manual/en/function.preg-replace-callback.php Edit -- https://main.php.net/note/edit/126865 Del: integrated -- https://main.php.net/note/delete/126865/integrated Del: useless -- https://main.php.net/note/delete/126865/useless Del: bad code -- https://main.php.net/note/delete/126865/bad+code Del: spam -- https://main.php.net/note/delete/126865/spam Del: non-english -- https://main.php.net/note/delete/126865/non-english Del: in docs -- https://main.php.net/note/delete/126865/in+docs Del: other reasons-- https://main.php.net/note/delete/126865 Reject -- https://main.php.net/note/reject/126865 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217634) next »