Skip to main content

All Questions

Tagged with
0 votes
1 answer
88 views

Object Iteration [closed]

I know that iteration over an object is equal to iterating over the visible properties of the class. class MyClass { public $var1 = 'value 1'; public $var2 = 'value 2'; public $var3 = '...
hoseinz3's user avatar
  • 638
9 votes
1 answer
139 views

What is the reasoning behind the refusal of PHP to accept the return types in this simple situation?

In PHP 7.1.4, using strict typing, I have a simple object oriented setup involving some interfaces, and some classes implementing those interfaces. Below example, as you would expect, works fine. ...
Istvan Dupai's user avatar
-1 votes
2 answers
135 views

what happens when I create a object instance of my class

I have two class like this: class one { public $var1 = 'anythig'; } class two { public $var2 = 'anythig'; } I want to know when I create a object instance of these classes what happens? My ...
user avatar
-1 votes
2 answers
104 views

How (if possible) to optimize memory in this PHP example

I am trying to understand how PHP handles memory consumption in these two examples. Example: 1 // foo.php class foo{ public function __construct() { $a = new PDO(......
robue-a7119895's user avatar
9 votes
2 answers
4k views

Is there ever a need to use ampersand in front of an object?

Since objects are passed by reference by default now, is there maybe some special case when &$obj would make sense?
LDusan's user avatar
  • 205