Darkmatter5 Posted February 12, 2009 Share Posted February 12, 2009 What is the notation to square a number? Like 2^2 =4 I tried: $square=2^2; echo "The square of 2 is $square"; It echos "The square of 2 is 0". Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 12, 2009 Share Posted February 12, 2009 http://www.php.net/manual/en/function.pow.php ^ is an bitwise XOR if I remember correctly. Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted February 12, 2009 Share Posted February 12, 2009 or if it's simply squaring rather than higher powers (e.g. cube) that you want: $square=2*2; echo "The square of 2 is $square"; What do they teach in mathematics in schools these days? Quote Link to comment Share on other sites More sharing options...
Darkmatter5 Posted February 12, 2009 Author Share Posted February 12, 2009 pow() worked great! Thanks! 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.