All Questions
9
questions
1
vote
1
answer
26
views
PHP7 pthreads3 woes : Unable to increment public property of Threaded class from within an instantiated Worker object
I am confused by the results from the following simplified code.
A Threaded object MyPool is to instantiate a variable number of MyWorker objects. As each MyWorker object is correctly instantiated, ...
2
votes
3
answers
2k
views
PHP: Changing default visibility of undeclared class properties to protected/private
In PHP, undeclared class properties/variables will default to "public" visibility.
Is there a way (for certain classes, but not all) to change the default visibility to "protected" (or private)?
I ...
-1
votes
1
answer
67
views
Strange PHP Reaction
I'm getting some wierd reactions when running this script.
<?php
error_reporting(E_ALL);
class A {
protected $varOne = array(
"subVar1" => "",
"subVar2"...
0
votes
3
answers
47
views
php variable scope quetion
Here's the code first:
<?php
$test = 'nothing';
function check_test(){
global $test;
echo 'The test is '.$test.'\n';
}
function run($lala){
$test = $lala;
check_test();
}
...
0
votes
3
answers
108
views
undefined variable in construct function [closed]
I think this might be a simple issue of variable scope, but I'm stumped as to where the issue lies. Given the following lines of code
class mysqlaccess {
private $creds;
private $error;
protected $...
2
votes
4
answers
20k
views
PHP MVC Call Controller Function From View
Trying to learn PHP MVC. So far so good until this moment. I have function like this in my ./controllers/index.php
<?php
class Index extends Controller {
function __construct() {
...
0
votes
1
answer
269
views
PHP require - visibility scope
I found similar questions, but they didn't really target my problem.
I have a problem with my configuration file. I have index.php which requires config.php (it contains array of settings), later, ...
0
votes
2
answers
82
views
Prevent invocation of instance method X from context != Y
This is a tricky one.
I am "emulating" ZF Bootstrapping (surface appearance). Don't ask me why, call it academic interest. So I have a Bootstrap Abstract with a method "run" that iterates over ...
3
votes
3
answers
563
views
PHP Scope and Class Instance Interaction
It seems as though different instances of a class can know about each others' private member variables.
I have provided some code that attempts to showcase my issue, and I will try to explain it.
We ...