<?php $foo = [ '50/2021-10-31@2', '93/2021-11-14@2', '300/2022-02-14@2', ]; $bar = '2021-11-12'; $getTransitos = fn(string $test, array $values) => sscanf(array_values(array_filter( $values, fn($value) => strpos($value, $test) ))[0] ?? '', '%d/')[0] ?? null; var_dump($getTransitos($bar, $foo));
You have javascript disabled. You will not be able to edit any code.