ineedhelpbigtime Posted September 3, 2009 Share Posted September 3, 2009 Just trying to get an example to work... Wondering if i have all the required extensions... The problem i am having is with this function: function check_username($username) { global $taken_usernames; $resp = array(); $username = trim($username); if (!$username) { $resp = array('ok' => false, 'msg' => "Please specify a username"); } else if (!preg_match('/^[a-z0-9\.\-_]+$/', $username)) { $resp = array('ok' => false, "msg" => "Your username can only contain alphanumerics and period, dash and underscore (.-_)"); } else if (in_array($username, $taken_usernames)) { $resp = array("ok" => false, "msg" => "The selected username is not available"); } else { $resp = array("ok" => true, "msg" => "This username is free"); } return $resp; } All of the php runs correctly up until the => . I dunno why its not working. Is there some extension i need for this? It seems like => is exiting php much like ?> would.... Link to comment https://forums.phpfreaks.com/topic/172967-solved-just-trying-to-get-an-example-to-work-wondering-if-i-have-all-the-required/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 3, 2009 Share Posted September 3, 2009 If you are seeing raw php code in your browser, either php is not installed on your web server, you are using lazy-way short open tags <? and your code is not being seeing as php code, or you are not browsing to the file using a URL on your web server. So, does any php code work at all, use only full opening <?php tags in all your code, and what exactly is the URL you are entering in your browser? Link to comment https://forums.phpfreaks.com/topic/172967-solved-just-trying-to-get-an-example-to-work-wondering-if-i-have-all-the-required/#findComment-911613 Share on other sites More sharing options...
ineedhelpbigtime Posted September 3, 2009 Author Share Posted September 3, 2009 How embaressing... loaded the file by double clicking it rather than navigating to it via localhost :S. Thanks, sorry for wasting your time. Link to comment https://forums.phpfreaks.com/topic/172967-solved-just-trying-to-get-an-example-to-work-wondering-if-i-have-all-the-required/#findComment-911614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.