Jump to content

[SOLVED] 2 questions


popcornplya

Recommended Posts

The curly brackets are used to surround more 'complex' variables when setting them inline (not jumping out of a string)

 

$str = "{$shopProduct->title}:";
//is the same as
$str = $shopProduct->title.":";
//and on some servers it will work without the curly brackets
$str = "$shopProduct->title:";

 

Using public and private denotes the availability of functions, methods and variables withing an object.

 

var is still used so some examples;

 

public var $foo = "bar";

 

private var $bar = "foo";

 

$foo can be directly accessed from outside of the object where $bar can only be accessed by the object iteslf.

Link to comment
https://forums.phpfreaks.com/topic/141493-solved-2-questions/#findComment-740615
Share on other sites

The curly brackets are used to surround more 'complex' variables when setting them inline (not jumping out of a string)

 

$str = "{$shopProduct->title}:";
//is the same as
$str = $shopProduct->title.":";
//and on some servers it will work without the curly brackets
$str = "$shopProduct->title:";

 

Using public and private denotes the availability of functions, methods and variables withing an object.

 

var is still used so some examples;

 

public var $foo = "bar";

 

private var $bar = "foo";

 

$foo can be directly accessed from outside of the object where $bar can only be accessed by the object iteslf.

Thanks a lot :)

Link to comment
https://forums.phpfreaks.com/topic/141493-solved-2-questions/#findComment-740619
Share on other sites

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.