Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
15 questions with no upvoted or accepted answers
2 votes
0 answers
131 views

Why isn't php happy with a public method signature being incompatible with the parent private method signature?

The following piece of code <?php class A { private function test($str = null) { echo $str; } } class B extends A { public function test() { echo 'b'; } } $b = ...
greg0ire's user avatar
  • 23.1k
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, ...
Viktorius's user avatar
1 vote
0 answers
184 views

Override a public function by a private function in php

I am using laravel as framework and I love the Eloquent objects. But now I have an Eloquent object, which only is allowed to be created within specific functions. In normal cases I would make the ...
Jetse's user avatar
  • 1,796
1 vote
2 answers
879 views

Create page visible only for admins on simple user system in PHP

I am creating a system where users can add items on a calendar and add reports about competitions. But I want to activate them before they are visible on the website. I have got a row with kal_active ...
user3428971's user avatar
0 votes
1 answer
2k views

How to hide when ACF relationship field is empty on Elementor without using a plugin

I have a custom post type called "Product" and I have ACF relationship field called meta_product_hands_on_review to pull related review posts in the product. I would like to hide a link &...
H Hong's user avatar
  • 1
0 votes
1 answer
68 views

Change visibility of content by header

I need to redirect the user in this code example, so I don't have a option. But I want to make a Box visible, when the result is success, but I can't echo the visibility by the ID, and I can't find a ...
nanchalantflow's user avatar
0 votes
1 answer
118 views

PHP class loaded by child process becomes visible in parent process?

I am trying to add a mechanism for loading classes on demand and then basically unloaded them / being able to reload them. Essentially, each time the class is needed, it should be loaded freshly from ...
InterLinked's user avatar
  • 1,374
0 votes
0 answers
346 views

How to change visibility of any method from a PHP object on runtime?

Ok folks, this is what I'm trying to accomplish here. I want to call a method each time that another method is called, like a middle man. I'm aware of these magic methods: __call($method, $args) and ...
Ralph Moran's user avatar
0 votes
0 answers
38 views

How to make available only those public methods which are declared in interface?

In Java, for example, this comes out of the box due to static nature of the language. But in PHP this could be also useful especially to keep a code secure and clean from an architectural point of ...
Mikhail Karakulov's user avatar
-1 votes
1 answer
154 views

How handle visibility change of property in class when using serialized objects?

UPDATE: As someone says this question is a bit unclear. I couldn't really understand it myself. But I did dig up the solution. It's a PHP bug that has been resolved. The server this legacy code runs ...
Bobo Wieland's user avatar
-1 votes
1 answer
459 views

Disable Woocommerce products based on their regular price value

On my Woocommerce website, I have a plugin which sometimes change product price to regular price = null (for different reasons). When that happens, we'd like to disable the product so it doesn't ...
user8886949's user avatar
-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"...
Alex's user avatar
  • 3
-1 votes
1 answer
47 views

weird behaviour with protected static properties and inheritance in php

I have a problem with static members and inheritance in php Why this works: class A { public static function me() { echo static::$b; } } class B extends A { protected static $b = "hello"...
cubob's user avatar
  • 61
-1 votes
1 answer
89 views

Trying to pass number of results variable in php

I am passing an sql query through a function that returns the number of results from a SELECT query. The result is a correct count for the mysqli_num_rows() method but does not set the counter ...
Pj Rigor's user avatar
  • 401
-2 votes
1 answer
99 views

Visibility JQuery Function (ready(), change()...)

I have 3 Files: Php file where i include the other two files like this: <head> <!-- 1. Javascript File--> <script src="js/functions.js"></script> </head> <...
Philipp Götz's user avatar