Category "php"

PHP header location absolute URL

I came across an issue where an absolute path set in header location wouldn't work but pointing to the file itself did. This only affected a few customers. One

PHP usort() order in case of equality

In the PHP manual for usort(), it states: If two members compare as equal, their relative order in the sorted array is undefined. Also, A new sort al

Laravel: Why is my variable not being set while it's in the construct function of the controller?

class Controller extends BaseController { use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests; private $host; private

Count number of slides of ppt file in php

I am trying to get the number of slides of a ppt file. I am getting the number of slides sometimes but sometimes it will not give me the count. I don't get what

Spam Filter in Contact Form

With an HTML contact form such as HTML contact form <h1>Contact Form</h1> <p>Please fill in the following details and click on SEND.</p&g

Starting a large PHP project. Is OOP necessary or is it just a preference?

I started learning PHP awhile ago. I guess I'm fairly okay in it. I want to write a Content Management System, just as a project for myself, however long it may

Two buttons one form

<?=form_open('blog/register');?> <table> <tr> <td><label for="register_name">User

How to save php socket resource in database?

I am creating a socket in php with socket_create and would like to store the received socket in a database (to access from other php code). However the socket i

Prestashop cUrl Login

I'm trying to log-in as customer using cUrl method in Prestashop. When I send my cUrl request, my values are inserted in the log-in form but the form is not s

PHP, Returning to a calling Page after saving a record in a Edit page

Lets say I have a Page with a List (list.php). I click on a row on that list to Edit that record. I go to a edit.php Page. I have 3 buttons on that edit.php pag

protect my blog content

Good evening, is there any way to protect my blog content (text-picture) from copy/paste. I've tried Javascript, but it's easy to desactivate it. Any magical

Remove categories with all childs derived from parent category

I want to remove all related child categories from parent categories. I think I need a recursive function to solve this. Here is my attempt: public function de

send email using gmail-api and google-api-php-client

I am using https://github.com/google/google-api-php-client and I want to send a test email with a user's authorized gmail account. This is what I have so far

GA4 custom event from server side, can someone tell me how i can do the following code in php?

const measurement_id = `G-XXXXXXXXXX`; const api_secret = `<secret_value>`; fetch(`https://www.google-analytics.com/mp/collect?measurement_id=${measureme

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

After upgrading Ubuntu from 14.04 to 16.04, PHP CLI started complaining about xdebug: $ php -v Cannot load Xdebug - it was already loaded PHP 7.0.13-0ubuntu0.1

Need to display only array value in JSON output

How to display only array value in JSON out in php I am using below PHP code echo '{"aaData":'.json_encode($user_details).'}'; And it return below output {

Session timeout in Yii2

I have used built in yii2 function to set session. I am not able to use built in yii2 login because of some requirement. So I have set session using below:

Wordpress check if is tag page

Is there a function like is_single for the tag page? something like is_tag?I need to do an if statement and something like this will be usefull. Thanks

Detect emoticons in string

I found that you need PHP 7 and MySQL 5.5 to use emoticons in a string that you want to upload to the database. I don't have these specification on my server s

How to create multiple sheet in Excel File PHP

I am trying to add two sheets in Excel file using my php code. Here is the code $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel= $objReader->load(SS_AD