rawdata Posted July 12, 2009 Share Posted July 12, 2009 Not really sure how to efficiently search for what I am looking for help with, so if this has been asked before, please accept my apologies. I have a program that virtual pilots use to report their flights with that uses php. Some of the flights these pilots report are called "maintenance" flights. The problem is, the program has no checkbox to show that it is a maint. flight. I need to know if there is a way to have the pilot enter the flight number with an "M" as the first character and then write a conditional that keys off of the first character no matter what follows. Quote Link to comment https://forums.phpfreaks.com/topic/165699-is-it-possible/ Share on other sites More sharing options...
.josh Posted July 12, 2009 Share Posted July 12, 2009 if (substr($variable,0,1) == "M") { // do something } Quote Link to comment https://forums.phpfreaks.com/topic/165699-is-it-possible/#findComment-874078 Share on other sites More sharing options...
Daniel0 Posted July 12, 2009 Share Posted July 12, 2009 Or alternately, if ($variable[0] == 'M') { // do something } Strings can be accessed like an array. Quote Link to comment https://forums.phpfreaks.com/topic/165699-is-it-possible/#findComment-874119 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.