<?php $stocks = [ "stock0" => 1, "stockdate0" => '', "stock1" => 3, "stockdate1" => 'apple', "stock4DON'TMATCHTHIS!!!" => 4, "stock2" => 2, "stockdate2" => '', "stock33" => 333, "stockdate33" => '' ]; $find = 'stock'; var_export( array_filter($stocks, fn($k) => rtrim($k, '0..9') === $find, ARRAY_FILTER_USE_KEY) );
You have javascript disabled. You will not be able to edit any code.