kernelgpf Posted November 23, 2007 Share Posted November 23, 2007 I need to dynamically seperate a string: it'll be in this format "1111:dragon". The number will be dynamically generated, but I need to seperate the number from the creature type after the colon and put both into seperate variables. How do I do this? Thanks! -Alyssa Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/ Share on other sites More sharing options...
phpQuestioner Posted November 23, 2007 Share Posted November 23, 2007 you need to explode that variable. more information can be found here: http://us2.php.net/manual/en/function.explode.php Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/#findComment-397267 Share on other sites More sharing options...
kernelgpf Posted November 23, 2007 Author Share Posted November 23, 2007 The creature type will be dynamically generated, as well. ..how do I do that, php_fr3333k? I've looked in the manual, I don't understand.. Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/#findComment-397268 Share on other sites More sharing options...
phpQuestioner Posted November 23, 2007 Share Posted November 23, 2007 we need to see some code; so we know where to go from. is "creature type" this variables name? Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/#findComment-397269 Share on other sites More sharing options...
revraz Posted November 23, 2007 Share Posted November 23, 2007 <?php $string = "1111:dragon"; $var = explode(":",$string); var_dump($var); ?> Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/#findComment-397270 Share on other sites More sharing options...
kernelgpf Posted November 23, 2007 Author Share Posted November 23, 2007 Perfect, revraz, but I need to STORE the two values in seperate variables.. how do I do that? Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/#findComment-397272 Share on other sites More sharing options...
kernelgpf Posted November 23, 2007 Author Share Posted November 23, 2007 Nevermind, figured it out! Thanks! Link to comment https://forums.phpfreaks.com/topic/78507-solved-seperate-string/#findComment-397273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.