Jump to content

Question about syntax


wohlm

Recommended Posts

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

'|'  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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.