Category "php"

PHP-Sort array based on another array?

OK, I already got this question in stackoverflow but sadly it's in javascript - Javascript - sort array based on another array and I want it in PHP $data = ar

Docker running really slow on mac after PHP 7.4 > 8 update

We've recently updated our docker config from PHP7.4 to PHP8 running on Ubuntu 20.04. For most of the team this has been fine. For me and one other (both using

How to get unique slug to same post-title for other time too?

I have tried the codes as follows. $post->title = $request->title; $post->body = $request->body; $post->slug = str_slug($post-

Error: element (body) is not in DOM or there is no element(body) with text "NameTest000"

I am doing an assignment and have to create a smaller version of ecomerce website. To test it I was given a link to a their autoQA tester which gives me the fol

wp_remote_get() not passing authentication

I've been trying to use wp_remote_get for the first time and having some troubles. So far I'm testing the response with this code: <?php

Toggle between a textbox and a select using PHP

I have a basic customer information form that I would like to make a little more interactive. The idea being if the user selects a country that is not USA or C

How to post data with fetch to functions.php

I am trying to make a fetch request to the functions.php file. I am trying to avoid jQuery and Ajax thats why I am using the standard fetch API. My code in one

How do I refresh a DIV content?

<div id='here'></div> I am trying to refresh a certain div within a bunch of divs. The div content is basically generated by PHP along with data f

How to convert time from one timezone to another in PHP

I have a code see below. The time zone for the time 16:17 is Europe/Vilnius. My goal is to apply time zone $tz2 = 'Africa/Dakar' and get 16:17 time in Africa/Da

httpd.conf on Windows: can't locate API model structure `php8_module`

I'm trying to install PHP, Apache and MySQL on Windows, following these guidelines. At some point, I am prompted to edit httpd.conf to point to my PHP installat

Implode array with array of glue strings

I have a awkward need but I need to interleave an array with another array before imploding the result. I guess my better option would be less talk more example

merge all files in directory to one text file

In PHP, how can I open everyfile, all text files, in a directory and merge them all into one text file. I don't know how to open all files in a directory, but

Bootstrap dropdown not working on include header php

I have two pages home.php and header.php now the header file has the the top navigation bar that is to be included in the home.php page.I used a bootstrap drop

Show only featured products in Woocommerce shop page

I want to display in default shop page from WooCommerce only featured products, nothing more... It's there a solution to display in WooCommerce shop template on

Get latest Tweets - What API

I know this has been discussed a lot here, but I still don't seem able to find aworking solution. Either it's out of date, it's the wrong programming-language o

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

In this section of the yii2 installation guide there's the following instructions: With Composer installed, you can install Yii by running the following c

How to KeyBy where multiple items have the same key

I am using Laravel Collections methods and am trying to key my query results (which are a collection) by the id. The problem is I have multiple entries with the

Please help improve the data to be compiled [closed]

I have data with the table as follows: enter image description here In my Model: <?php namespace App; use Illuminate\Database\Eloquent\Mo

Laravel 5.1 Unknown database type enum requested

While running php artisan migrate, I got the following error [Doctrine\DBAL\DBALException] Unknown database type enum requested, Doctrine\DBAL\Platforms

Open a popup box after receiving result from ajax

i have a ajax code that works properly and gives the desired result. I want to modify this code and want that when a reply is received from ajax a popup/modal b