corillo181 Posted October 15, 2007 Share Posted October 15, 2007 can some one tell my why this is not woking $email = something@this.com; $find = '@'; echo strstr($email,$find,true); //prints nothing; //expected something; but if i do $email = something@this.com; $find = '@'; echo strstr($email,$find); //prints something; Quote Link to comment https://forums.phpfreaks.com/topic/73294-strstr-question/ Share on other sites More sharing options...
zq29 Posted October 15, 2007 Share Posted October 15, 2007 Are you running PHP6? The third parameter was added in version 6. Quote Link to comment https://forums.phpfreaks.com/topic/73294-strstr-question/#findComment-369818 Share on other sites More sharing options...
corillo181 Posted October 15, 2007 Author Share Posted October 15, 2007 oh i looked at the documentation and it says php 4 and 5. function username($id){ $email = something@this.com; $search = strpos($array['email'],'@') - 1; $len = strlen($email); $sub = substr($email,0,-($len-$search)+1); return $sub; } this is the way i did it, those any one have a better way? Quote Link to comment https://forums.phpfreaks.com/topic/73294-strstr-question/#findComment-369821 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.