Jump to content

Waht do these mean in php "{}"


daboymac

Recommended Posts

They have multiple meanings.

 

This is true:

These are used when echo'ing an array within a string. Without those braces PHP will get confused. You can add these into code to help PHP out.

 

PHP.net includes a description of the difference between interpreting 'Mascot' as a string, a value, or a literal (diff analysis).

 

It also is used in RegExp to define a range of values:

$pattern = '/[0-9]{1,2}/'

Where that means that two numbers from 0 - 9 show up at least once, and no more than two times. {1,2} = {min,max}

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.