<?php
$foo =
array (
'stock0' => 1,
'stockdate0' => 1,
'stock1' => 3,
'stockdate1' => 2,
);
$keys = array_keys( $foo );
foreach ( $keys as $key ) {
if ( preg_match( '/stock.$/', $key ) ) {
var_dump( $key );
}
}
I'm hoping I interpreted correctly and you wanted 'stock', 1 wildcard character thats not a newline, then end of string.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…