slj90 Posted May 24, 2014 Share Posted May 24, 2014 For example if $names has a value of "Mark/Ben/James/Tom" how would I separate it to give each name its own variable, e.g $name1, $name2, $name3 Thanks, Link to comment https://forums.phpfreaks.com/topic/288735-separate-variable/ Share on other sites More sharing options...
Jacques1 Posted May 24, 2014 Share Posted May 24, 2014 Numbering variables is a bad idea. Just make an array: <?php $name_list = "Mark/Ben/James/Tom"; $names = explode('/', $name_list); echo 'The first name is: ' . $names[0]; Link to comment https://forums.phpfreaks.com/topic/288735-separate-variable/#findComment-1480703 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.