chris_2001 Posted October 28, 2007 Share Posted October 28, 2007 Ok well I have a program sending me an array of data, which i then change into variables like so: $level = $status['7']; that works fine and is very basic, but the program sends the data as Level: 53 I want to change the variable so it is just 57 not Level: 57 and I have no idea how to do that (changing the program is not an option). thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/75114-solved-editing-a-variable-sent-by-external-program-no-idea-how-2/ Share on other sites More sharing options...
Dragen Posted October 28, 2007 Share Posted October 28, 2007 a simple option: $level = str_replace('Level: ', '', $status['7']); very basic though. You might be better of using preg_replace if the part before the number is sometimes different to 'Level: '. Quote Link to comment https://forums.phpfreaks.com/topic/75114-solved-editing-a-variable-sent-by-external-program-no-idea-how-2/#findComment-379881 Share on other sites More sharing options...
chris_2001 Posted October 28, 2007 Author Share Posted October 28, 2007 Thx so much Quote Link to comment https://forums.phpfreaks.com/topic/75114-solved-editing-a-variable-sent-by-external-program-no-idea-how-2/#findComment-379911 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.