<?php

// 입력 문자열
$str = '1234567890-a-b-c-d-e-f-g';

// 숫자가 아닌 문자를 모두 빈 문자로 치환
$str = preg_replace('/[^0-9]/', '', $str);

// 출력
echo $str;

?>