Re: Fixing new problems due to deprecations ...

From: Date: Mon, 28 Sep 2015 17:45:02 +0000
Subject: Re: Fixing new problems due to deprecations ...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-325145@lists.php.net to get a copy of this message
On Mon, Sep 28, 2015 at 10:54 AM, Kalle Sommer Nielsen <kalle@php.net> wrote: > 2015-09-28 18:49 GMT+02:00 Lester Caine <lester@lsces.co.uk>: > >> - 'sort'=>preg_replace('/([0-9]+)/e', > >> 'substr("000000000\\1", -10)', > $value) > >> + 'sort'=>preg_replace_callback('/([0-9]+)/', function > >> ($match) { > return substr("000000000$match", -10); }, $value) > > Without looking at the documentation, and just reading the error and > some common sense, then $match would be an array and when used in > interpolation, it would be converted to a string. So it is likely you > would need to reference a specific index in the $match array for it to > work. like: "000000000{$match[???]}" > More specifically, since in e mode you're using the \\1 sub-pattern callback, you'll want to {$match[1]} in the string. -- Dero

« previous php.general (#325145) next »