All Questions
Tagged with php-internals oop
5
questions
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 = '...
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.
...
-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 ...
-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(......
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?