pneudralics Posted June 11, 2010 Share Posted June 11, 2010 I hired a coder to build me a small section for a website. I've never seen the * used before and was just wondering what it meant. print $user."*".$id; Quote Link to comment https://forums.phpfreaks.com/topic/204531-what-does-the-star-in-php-mean/ Share on other sites More sharing options...
Alex Posted June 11, 2010 Share Posted June 11, 2010 That's just a string, it's not doing anything. All that line of code does is print out of the variable $user then * then the variable $id Ex: $user = 'foo'; $id = 1; print $user."*".$id; // Output: foo*1 Quote Link to comment https://forums.phpfreaks.com/topic/204531-what-does-the-star-in-php-mean/#findComment-1070966 Share on other sites More sharing options...
Daniel0 Posted June 12, 2010 Share Posted June 12, 2010 Did you even try running the code to see what happens? Quote Link to comment https://forums.phpfreaks.com/topic/204531-what-does-the-star-in-php-mean/#findComment-1070975 Share on other sites More sharing options...
mrMarcus Posted June 12, 2010 Share Posted June 12, 2010 It is more commonly used as a mathematical operator for multiplication. <?php echo 8*8; //equivalent to 8x8 or 8 multiplied by 8. Notice it is not being used in string format as in the original example. ?> Quote Link to comment https://forums.phpfreaks.com/topic/204531-what-does-the-star-in-php-mean/#findComment-1071010 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.