Skip to main content
-1 votes
1 answer
4k views

I got an error while activating a plugin in my WordPress website Fatal error: Uncaught Error: Call to undefined function create_function() in /home4/seosexey/gifting.icowebtech.com/wp-content/plugins/...
Meena Arya's user avatar
-1 votes
2 answers
1k views

I use the map function to loop each object of collections. The closure method is too long and I tried to make it a private function. But I cannot successfully call the function. Here is my sample code....
Chao's user avatar
  • 179
1 vote
1 answer
137 views

When using an anonymous PHP function that is defined inside a class context, the docs say "the current class is automatically bound to it, making $this available inside of the function's scope". But ...
Erdss4's user avatar
  • 1,155
0 votes
2 answers
265 views

I'm trying to achieve almost similar things/properties of closure in PHP which is available in JS. For example function createGreeter($who) { return function(){ function hello() use ($...
Rupesh Arora's user avatar
0 votes
1 answer
43 views

The following code is working as expected: $b = 42; var_dump("b: " . $b); class A { function foo() { global $b; var_dump("b: " . $b); } } $instance = new A(); $instance-&...
sylbru's user avatar
  • 1,631
-1 votes
2 answers
80 views

I have an array (class property) which stores PHP methods (i.e., of class 'Closure'). Just like this. $this->methods[$name]=$action; $action is the function. When I try invoking the function ...
Munavir Chavody's user avatar
1 vote
1 answer
48 views

I have a lumen collection object for my order and use map function to iterate over it and do some logic. I also need the total value of the order which is calculated using quantity * price. But the ...
JackSlayer94's user avatar
0 votes
2 answers
46 views

So mainly this is caused by my code structure: File1.php use \Class1 as Blah; require 'File2.php'; File2.php $closure = function ($arg) { return new Blah($arg); }; Somehow the part behind ... ...
machinateur's user avatar
1 vote
2 answers
3k views

There is a need to perform a specific process multiple threads. I learned about the extension for php - pthreads. For example, a simple script outside Laravel works fine and I liked the results. I ...
Nik Gubin's user avatar
0 votes
1 answer
58 views

I'm using Laravel Illuminate/Database outside of laravel application. I'm trying to pass the Eloquent model as my closure argument but its throwing an error. May be I'm passing it wrongly. My code is ...
Manish Jangir's user avatar
2 votes
2 answers
5k views

I am having a foreach loop that goes through an array, and saves data with eloquent. And it works fine when it is like this: foreach($questions['questions'] as $question) { $questionObject = ...
Ludwig's user avatar
  • 1,881
1 vote
1 answer
380 views

Setup I'm accessing this url: <host>/render/z63034/RBLR/GLZB. My url pattern is as such: /render/[a:title]/[a:bpFrom]/[a:bpTo]. My route gets added like so: $router->map("GET", "/render/[...
Marius Schär's user avatar
4 votes
1 answer
2k views

use keyword with php closure is a pretty clear way to extend the scope of handpicked variable to closure. Is there any way if we need to update the value of some variable in caller function scope ...
Shoaib Nawaz's user avatar
  • 2,330
7 votes
2 answers
3k views

I have a function that is being passed a Closure. I want to find out the name of the method that closure is derived from. When I call print_r, it outputs this: Closure Object ( [static] => Array ...
Benubird's user avatar
  • 19.7k
1 vote
1 answer
650 views

So, how do you compare classes that contain Closure ? It looks like you can't. class a { protected $whatever; function __construct() { $this->whatever = function() {}; } } ...
user2398964's user avatar

15 30 50 per page