|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-03-16 23:42 UTC] felipe@php.net
-Status: Open
+Status: Bogus
[2011-03-16 23:42 UTC] felipe@php.net
[2011-03-16 23:56 UTC] donciprian at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
Description: ------------ I am trying to filter numbers from the end of a string in a array. i have a array full of these strings : $testArr = array('foto_1','foto_45'); $resArr = preg_grep('/[0-9]*$/',$testArr); and the $resArr array that gets returned from preg_grep, contains the same strings, i am looking for a array that contains just the numbers that were filtered using the regex Test script: --------------- <?php $testArr = array('foto_1','foto_45'); $resArr = preg_grep('/[0-9]*$/',$testArr); print_r($resArr); ?> Expected result: ---------------- to see a array full of the numbers what were at the end of the string in the input array something like this : Array ( [0] => 1 [1] => 45 ) Actual result: -------------- Array ( [0] => foto_1 [1] => foto_45 )