Skip to content

Recursive IIFE(Immediatly invoked function) in php 7

is it possible to use recursion with immediatly invoked function with php 7? For exemple if i want to code a recursive version of a fibonacci series? Following exemple does not work, but i hope it will help you to get my idea. Answer Yes you can use iife in php 7 like this: or

Getting the second part of a URL through PHP

I’m trying to setup a page that pulls just a part of the URL but I can’t even get it to echo on my page. Since I code in PHP, I prefer dynamic pages, so my urls usually have “index.php?page=whatever” I need the “whatever” part only. Can someone help me. This is what I have …

Algolia not importing my records laravel scout

I am using laravel scout to implement my text search. I followed all the configuration instructions and imported the records. When I do that i get this success message Imported [AppThread] models up to ID: 8 but in algolia I can’t see my records for the given index, it keeps saying I have 0 records. I a…

How to pass arguments to custom composer script

In my Laravel project, I want to run phpunit for a single file, like this one: Here is my composer setup: However, I’m running into this error: www@287dd7480e22:/var/www$ composer run-script test tests/Unit/Services/OrderServiceTest.php php artisan config:cache –env=testing ‘tests/Unit/Servi…

Simplify PHP array with same items

I have this PHP array: $this->user_list = array( 0 => ‘Not paid’,1 => ‘Not paid’, 2 => ‘Not paid’, 7 => ‘Waiting, 15 => ‘Waiting’, 10 => ‘Cancelled’ ); How can I simplify …