Re: Fixing new problems due to deprecations ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 28, 2015 at 10:54 AM, Kalle Sommer Nielsen <kalle@xxxxxxx>
wrote:

> 2015-09-28 18:49 GMT+02:00 Lester Caine <lester@xxxxxxxxxxx>:
> >> - '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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux