Categories
How to get two parameters from a string?
I get post data in the form of title-desc-2013-04-28 How to pull out the title and desc? If I do this, I get only the title $title = trim(strstr($_POST['title'], '-', true));
$title = trim(strstr($_POST['title'], '-', true));
Answer the question
In order to leave comments, you need to log in
$_POST['title'] = 'title-desc-2013-04-28'; $array = explode('-', $_POST['title']); $title = $array[0]; $desc = $array[1]; var_dump($title); // title var_dump($desc); // desc
[$title, $desc] = $array;
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question