Category "php"

Chunk and transpose a flat array into rows with a specific number of columns

An array of values are provided in the order they should appear in columns. For example, the second value in the array should be displayed on a webpage beneath

Make certain characters of a word from string bold

I need to highlight a certain characters from a string, I tried str_replace and preg_replace. But these work only if full word is entered, $text = str_replace(

Why does array_map() with null as callback create an "array of arrays"?

Today I learned about a special case of array_map() in PHP, which is mentioned as a side note in the documentation: Example #4 Creating an array of arrays

Having trouble with PDO queries (Notice: Undefined index)

I'm trying to extract a data from database, I'm using PDO to do it. I have the following PHP code without success: public function CheckIdentity($email, $passwo

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

I'm using Symfony for a project and I have been trying to get the login to work on production server with no success for the past 2 days. I keep getting the err

Handling expired token in Laravel

What is the best way to handle expired tokens in laravel 5. I mean I have a page and it has some links which perform ajax requests. They work fine when the pa

Laravel relationship belongsToMany with composite primary keys

I have 3 tables and I'm trying to make relations between order_products and order_products_status_names. I have transition/pivot table named order_product_statu

Facebook API, get page post link (PHP)

Here's some code: $facebookUrl = 'https://graph.facebook.com/'.$facebookPageId.'/posts?&access_token='.$facebookAppId.'|'.$facebookAppSecret; $facebookData

WHERE IN array binding in DB::raw laravel 5.4

I'm trying to bind an array in a raw WHERE IN query in the Laravel DB example: $arr = [1,2,3]; DB::select(DB::raw("select * from test1 WHERE id IN ? "), [$arr

How does this Facade works

I'm working with Laravel 5.8 and it's an Online Store project written by other programmers. Basically I have faced something weird that never seen before. Let's

Converting IPv6 to IPv4 address in PHP

I need to convert IPv6 addresses to IPv4 addresses. To do this, I used code from pedmillon's answer to a related question: $ipv6 = $_SERVER['REMOTE_ADDR']; $ip

Problems getting instance of UploadedFile in Yii2

I tried to upload a file to a server using UploadedFile class, but I can't get an Instance. In my Model: public $arch; public function rules() { return [[[

How to use PHPCBF to fix one issue at a time?

I've added a PHPCS configuration to get some standards into a legacy project. I'm using a relaxed version of PSR-2 as an interim step. Now what I want to do, i

WAMP Virtual Host not working

I am using a wamp version 2.5 My Apache is 2.4.9 PHP: 5.5.12 MySQL: 5.6.17 I have these configurations: On my httpd.conf # Virtual hosts Include conf/extra/h

Non Receipt of the email sent by XAMPP Mercury Server with Gmail SMTP Settings at Local Host

I have setup the php.ini and sendmail.ini with smtp.gmail.com with my gmail ID and password with my xampp folder on local computer. The message is successfully

How to update array value in Laravel

My controller code: $userBasicInfoId = $this->userBasicInfo->where('user_id', $userProfile['id'])->value('id'); if($userBasicInfoId) {

file_put_content...fail to open stream:Permission denied in Laravel 5

The error is mention in below:- ErrorException in Filesystem.php line 81: file_put_contents(/var/www/html/Training-management-system/storage/framework/views

Font family issue in dompdf

I'm using DOMPDF v0.8.0 I'm having a problem with this library. I'm using this dompdf library with codeigniter2. I need to implement digital signature and co

How to show a popup modal in codeIgniter?

I have written a javascript click function to a class to display a popup when the relevant class be clicked. When i just put an alert it gives me the correct ou

How do I do HTTP basic authentication using Guzzle?

I want to do basic access authentication using Guzzle and I am very new to programming. I have no clue what to do. I tried to do this using curl but my environm