25-05-1394، 11:24 ب.ظ
29-05-1394، 01:24 ق.ظ
$str = 'DEL-12313'; if (strpos($str,'DEL') !== false) { $code = explode('-', $str); $code = $code[1]; }
29-05-1394، 09:50 ق.ظ
$str = 'This is a product: DEL-12313. This one is another product: DEL-4519'; if(preg_match_all('#(DEL-(d+))#', $str, $matches)) { echo '<pre>' . print_r($matches[1], true) . '</pre>'; echo '<pre>' . print_r($matches[2], true) . '</pre>'; } else { echo '<p>Not Found</p>'; } /* Output: Array ( [0] => DEL-12313 [1] => DEL-4519 ) Array ( [0] => 12313 [1] => 4519 ) */