Category "php"

How can I format price in javascript?

I have this PHP code below which can format product price. I want to do this same task with javascript. Is there any way to do this same task with javascript? P

Redirect Loop happen when the session is not set

"Session.php" if(!isset($_SESSION['username'])) { header('Location: ./index.php'); // Redirecting To

openssl_pkcs7_verify(): signature OK, but cannot open for writing

I'm trying to decrypt a payload from a request it's working to decrypt but give me this error I searched a lot but can't find nothing specific. I also used thi

PHP conditionally pass nested arrays as function argument

I got two nested index arrays, which I want to populate with values using a function. But on a conditional basis: if this, populate the first array; if that, po

Laravel - Method Illuminate\\Support\\Collection::makeHidden does not exist

I want to hide the columns password & OTP ,that is included in $uses result. Actually these 2 columns are part of the users table. I've tried like below. B

Laravel pass view field input data to controller and then return calculated value in disabled field

So what i want to do is take values from user input, then do some calculation with it inside the controller with method and that method return value to be displ

PHP array_search is very slow - how can i speed up?

I have two arrays one is a response from an API call where I get information about which email-addresses are already uploaded in the System -> $array_emails_

Remove a wordpress add_filter function from plugin

I have a plugin that is creating a custom template via add_filter: // Create a template view for the new CPT add_filter('single_template', [$this, 'setTemplateA

Substraction in woocommerce

my problem is as follows. I am currently generating a tax receipt for some orders (not all) in my woocommerce. but the customer would like for 3 of the 4 produc

Dialogflow V2 API - How to pass context and/or payload

I am trying to send context and payload to the Dialogflow V2 API. I am able to successfully send a queryString and get a response from my agent. However, I need

If $_POST is empty Multiple function

I have the following $_POST function to check if the fields of 'start', 'middle' and 'end' is empty or not. if(!empty($_POST['start'])) { $description = "a

Why does Laravel say that my "update" method is not a support route?

I am getting this error when I try to use update method from my routes. The UPDATE method is not supported for this route. Supported methods: GET, HEAD, POST, D

Search in a non-existing table - relationship

I try to make hasMany relationship in Laravel and I have this problem. If I rename table name in Model to test, relationship works fine, seraching by my new tab

json_encode fails because of Unknown charactar

I have this array : [responses] => Array ( [0] => Array (

PHP8 - SplFixedArray iterator's next() doesn't move key pointer

Please take a look at this code: <?php $array = new SplFixedArray(1); print "\nKey1: " . $array->getIterator()->key(); $array->setSize(5);

VS Code - does not recognize php 8 syntax

I have recently set up vsCode with PHP. However, it shows errors on following lines. public static function myFunction(): bool|string error : syntax error, un

how to send error emails to the developer in laravel 8 App

I am using laravel "laravel/framework": "^8.75" version. When deployed the app turn APP_DEBUG=false but users get errors but they can not know what is wrong and

Target class controller does not exist - Laravel 8

Here is my controller: <?php namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RegisterControlle

Admin login don't redirect to panel

I import a project on my local but I don’t have an access to the admin panel. I enter the right id/password, but after this, it's redirect me to

How to convert a json response into a callable object in php?

I'm trying to convert the json response below in $response variable to a callable function like $response->getStatus() so it can return failed. Here's the re