I have a variable, for example $name which is 4762840941_here-alone I need to extract the number section out, and the here-alone part like so: $nameid = "here-alone"; $nameno = "4762840941"; The $name variable can change to something longer like this: 12312312312392_here-i-am Is this possible?
list($nameid, $nameno) = explode('_', $name); echo $nameid; PHP: Assuming there will always be one underscore.