rondog Posted September 25, 2010 Share Posted September 25, 2010 I have a string: "system_controllers_qty" and i need it to be: "system_controllers.system_controllers_qty" I can use substr because the It wont always be 'system_controllers', it can be 'system_cpus' for example so I need to somehow break and the second underscore if possible. Any ideas? Link to comment https://forums.phpfreaks.com/topic/214382-help-with-string-stuff/ Share on other sites More sharing options...
PaulRyan Posted September 25, 2010 Share Posted September 25, 2010 Let me get this straight, are you wanting to break the string 'system_controllers.system_controllers_qty' so it looks like 'system_controllers.system' If this is the case, then let me know, if not, explain a little more bud. Regards, Paul. Link to comment https://forums.phpfreaks.com/topic/214382-help-with-string-stuff/#findComment-1115598 Share on other sites More sharing options...
rondog Posted September 25, 2010 Author Share Posted September 25, 2010 This works, but if you guys have a cleaner solution leme know, thanks! <?php $str = "system_controllers_qty"; $formatted = explode("_",$str); $formatted = $formatted[0] . "_" . $formatted[1] . "." . $str; echo $formatted; //system_controllers.system_controllers_qty ?> Link to comment https://forums.phpfreaks.com/topic/214382-help-with-string-stuff/#findComment-1115599 Share on other sites More sharing options...
rondog Posted September 25, 2010 Author Share Posted September 25, 2010 Let me get this straight, are you wanting to break the string 'system_controllers.system_controllers_qty' so it looks like 'system_controllers.system' If this is the case, then let me know, if not, explain a little more bud. Regards, Paul. Looks like we posted at the same time. Refer to my post Link to comment https://forums.phpfreaks.com/topic/214382-help-with-string-stuff/#findComment-1115600 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.