Skip to content

Tag: php-7

Line up two tables

I have two following arrays: Now I want to take the common part of them, based on the date value, starting from the top and bottom, so the result should look like this: I have started with something like this: But it does not work, if there is a difference in the middle, how can I repair this? Answer Get

How to create recursive array from the loop PHP? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year. Improve this question I have an array like below and its dynamic array. I want to create an anothe…

Install php-opcache for PHP installed via Remi’s repository

I have an environment with the following setup: Centos/RHEL 8 PHP 7.4 installed from Remi’s repository I have set installed php like so: Now I want to install php-opcache. However dnf is reporting that there doesn’t appear to be a module php74-php-opcache. I’m fairly convinced this has somet…

Migrate to PHP 8.0: Unbinding $this when $this is used

Step by step, I am migrating my project(s) from PHP 7.1 to PHP 8.0. In the official PHP manual, in the subchapter “Deprecated Features” of the chapter “Migrating from PHP 7.3.x to PHP 7.4.x”, I tried to understand the following deprecation description: Unbinding $this when $this is use…

refactor IF statement with multiple returns

I have a code similar to this: it is honestly not so looking good but I need to check the variables to respect some sort of priority order. I was guessing if there is a better way to write this? Answer You can use a switch / case where the condition is TRUE. Example: Further Reading: https://www.php.net/manua…

How to read a excel file with merged cells in php?

I wrote a php script that allows me to read an uploaded excel file and insert all the images contained in a folder by renaming them with the cell values “style” and “color” to have style_color.jpg. The script works fine but if I upload an xlsx file containing merged cells like this: im…