etingwall Posted January 26, 2009 Share Posted January 26, 2009 I've searched Google and the forums for this. What does the "^" carrot do in php? I had: $ans = 0.27 * ($base^0.25) and was getting bogus numbers for $ans. Changing to pow() solved my problem, but I'm curious as to what ^ does. I also have multiple conditional statements such as if($var > 10^10) Are those legitimate, or do I need to us pow()? Thanks. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 26, 2009 Share Posted January 26, 2009 it's a bitwise operator: http://us.php.net/manual/en/language.operators.bitwise.php Quote Link to comment Share on other sites More sharing options...
corbin Posted January 26, 2009 Share Posted January 26, 2009 I also have multiple conditional statements such as if($var > 10^10) Are those legitimate, or do I need to us pow()? Never use ^ unless you actually want to use it as a bitwise operator. Quote Link to comment Share on other sites More sharing options...
.josh Posted January 27, 2009 Share Posted January 27, 2009 It also has significance in regex. Quote Link to comment Share on other sites More sharing options...
corbin Posted January 27, 2009 Share Posted January 27, 2009 Ahhh yeah forgot about that..... Start anchor hehe. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted January 29, 2009 Share Posted January 29, 2009 Btw it's called caret, not carrot. Just figured it'd be nice to know Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 29, 2009 Share Posted January 29, 2009 Btw it's called caret, not carrot. Just figured it'd be nice to know i like to spell it c^r37 Quote Link to comment 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.