mminten
-
Posts
1 -
Joined
-
Last visited
Never
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Split a variable if it has a delimiter
in PHP Coding Help
Posted
I am trying to split a variable only if it has an integer. Here is what I want to do:
$id = 1234-54678;
should be split into and then placed into two variables:
$id1 = 54678;
$id2 = 1234;
Sometimes the variable may not have a delimiter in which case I would like it to be $id1
example:
$id = 54678;
should go directly to
$id1 = 54678;
I am a php rookie and don't know which way is best to do this (explode, split, etc.) so I would appreciate any help you can give me.