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? Quote Link to comment 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. Quote Link to comment 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 ?> Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.