wohlm Posted December 22, 2009 Share Posted December 22, 2009 I'm going through this book and I've came across this operator '|' What purpose does it serve? This is the example I was given echo '|'.$products[0][0].'|'.$products[0][1].'|'.$products[0][2].'|<br />'; It's printing the products array by key and value, but I don't know what that operator is. Link to comment https://forums.phpfreaks.com/topic/186074-question-about-syntax/ Share on other sites More sharing options...
Maq Posted December 22, 2009 Share Posted December 22, 2009 '|' What purpose does it serve? In this circumstance it doesn't signify anything more than to be a separator for each array value. Generally the pipe '|' symbol is used for the logical operator 'OR'. Read more here: http://php.net/manual/en/language.operators.logical.php Link to comment https://forums.phpfreaks.com/topic/186074-question-about-syntax/#findComment-982634 Share on other sites More sharing options...
salathe Posted December 22, 2009 Share Posted December 22, 2009 The single pipe is used for bitwise operations (working on binary), the double pipe is used as Maq said for logical operations; the '|' in your example, as Maq also said, isn't any special syntax, it's just that character in a string. Link to comment https://forums.phpfreaks.com/topic/186074-question-about-syntax/#findComment-982646 Share on other sites More sharing options...
Maq Posted December 22, 2009 Share Posted December 22, 2009 The single pipe is used for bitwise operations (working on binary) Ah yes, thanks for pointing that out . You can read/learn more in the manual: http://php.net/manual/en/language.operators.bitwise.php Link to comment https://forums.phpfreaks.com/topic/186074-question-about-syntax/#findComment-982651 Share on other sites More sharing options...
wohlm Posted December 22, 2009 Author Share Posted December 22, 2009 Thanks guys! Link to comment https://forums.phpfreaks.com/topic/186074-question-about-syntax/#findComment-982657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.