corillo181 Posted October 15, 2007 Share Posted October 15, 2007 can some one tell my why this is not woking $email = [email protected]; $find = '@'; echo strstr($email,$find,true); //prints nothing; //expected something; but if i do $email = [email protected]; $find = '@'; echo strstr($email,$find); //prints something; 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. 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 = [email protected]; $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? Link to comment https://forums.phpfreaks.com/topic/73294-strstr-question/#findComment-369821 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.