php - Explode integer range with minuses


Is any better solution for get first and second value exploded by "-" with negative values than use explode function and check how many minuses are there?

$list = [

I would like to receive:

$first = 10; $second = 20;
$first = 12; $second = 14;
$first = -5; $second = 10;
$first = -10; $second = -2;

People are also looking for solutions to the problem: php - How to strip/replace a slanted double quotes ″ with " in wordpress search query?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.