I have this kind of string:
1234567890(number without specific number of character)-(minus symbol serves as divider)text
How can I see and extract number before - symbol?
Use a regex like this:
preg_match('/^(\d+)/', '123-something', $match);
This will capture all decimal digits from the start of the string until the first non-decimal digit, and the result will be in the $match variable.
if (preg_match('/^(\d+)/', $string, $match)) {
$number = $match[1];
}