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; 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 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? 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. ?> 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
Archived
This topic is now archived and is closed to further replies.