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 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: '. 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 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
Archived
This topic is now archived and is closed to further replies.