I have a variable that looks like this:
$var = "Dropdown\n
Value 1\n
Value 2\n
Value 3\n";
As you can see, these are basically values broken into line breaks.
What I want to do is get the Option type, in this case "Dropdown" and save the rest of the values in another line.
So,
list($OptionType, $OptionValues) = explode("\n", $var);
The code above is what I tried, but this is what the lines came out like:
$OptionType = 'Dropdown';
$OptionValues = 'Value 1';
I want $ OptionValues to look like this: $ OptionValues = "Value 1 \ nValue 2 \ nValue 3 \ n";
How do I do something like this?
The parameter type will always be the first part of the string, followed by the parameter values, each of which is divided into a string.
It is organized in this way, since it comes from user input, and it greatly facilitates user management.