Most viewed questions in PHP

0 votes
1 answer

How to get the base domain/url in php?

Hello @kartik, Use SERVER_NAME. echo $_SERVER['SERVER_NAME'] ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,880 points
7,427 views
0 votes
1 answer

How do you set a default value for a MySQL Datetime column?

Hello @kartik, In version 5.6.5, it is possible ...READ MORE

Aug 18, 2020 in PHP by Niroj
• 82,880 points
7,355 views
0 votes
0 answers

Fetch data from database in php through AJAX,

The index.php  I created a connection with the ...READ MORE

Jun 16, 2022 in PHP by narikkadan
• 63,420 points
7,280 views
0 votes
1 answer

Error:PHP Notice: Undefined offset: 1

Hello @kartik, Change $data[$parts[0]] = $parts[1]; to if ( ! isset($parts[1])) ...READ MORE

Oct 20, 2020 in PHP by Niroj
• 82,880 points
7,116 views
0 votes
1 answer

How can I replace the deprecated set_magic_quotes_runtime in php?

Hello @kartik, I used FPDF v. 1.53 and ...READ MORE

Oct 29, 2020 in PHP by Niroj
• 82,880 points
7,070 views
0 votes
1 answer

Error:fetching http headers in SoapClient

Hello, This error is often seen when the default_socket_timeout value ...READ MORE

Nov 20, 2020 in PHP by Niroj
• 82,880 points
7,048 views
0 votes
1 answer

What does double question mark (??) operator mean in PHP?

Hello, It's the "null coalescing operator", added in ...READ MORE

Apr 2, 2020 in PHP by Niroj
• 82,880 points
7,027 views
0 votes
0 answers

PHP - Failed to open stream : No such file or directory

In PHP scripts, when I call include(), require(), fopen(), or ...READ MORE

May 16, 2022 in PHP by Kichu
• 19,050 points
6,852 views
0 votes
1 answer

What is type casting and type juggling in php?

Hey, The way by which PHP can assign ...READ MORE

Mar 27, 2020 in PHP by Niroj
• 82,880 points
6,792 views
0 votes
1 answer

How to access a global variable in a PHP function?

Hello @kartik, It is not working because you have to ...READ MORE

Nov 10, 2020 in PHP by Niroj
• 82,880 points
6,681 views
0 votes
1 answer

How to create and download a csv file from php script?

Hello @kartik, You can use the built in fputcsv() for ...READ MORE

Oct 27, 2020 in PHP by Niroj
• 82,880 points
6,585 views
0 votes
1 answer

How to save image from url with curl PHP?

Hello @kartik, try this: function grab_image($url,$saveto){ ...READ MORE

Nov 14, 2020 in PHP by Niroj
• 82,880 points
6,572 views
0 votes
1 answer

How to delete object from array inside foreach loop?

Hello @kartik, Use this: foreach($array as $elementKey => $element) ...READ MORE

Sep 15, 2020 in PHP by Niroj
• 82,880 points
6,531 views
0 votes
1 answer

How to post data in PHP using file_get_contents?

Hello @kartik, Sending an HTTP POST request using file_get_contents is ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,880 points
6,508 views
0 votes
1 answer

How to get the client IP address in PHP ?

Hello, Here is a code sample of a good ...READ MORE

Apr 8, 2020 in PHP by Niroj
• 82,880 points
6,479 views
0 votes
1 answer

Error:Jquery - Uncaught TypeError: Cannot use 'in' operator to search for '324' in

Hello @kartik, You have a JSON string, not ...READ MORE

Jun 16, 2020 in PHP by Niroj
• 82,880 points
6,400 views
0 votes
0 answers

How to download file from database/folder using php

I want to know how to create ...READ MORE

Jun 27, 2022 in PHP by narikkadan
• 63,420 points
6,360 views
0 votes
1 answer

Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?

Hii @kartik, Working with different servers with various ...READ MORE

Apr 20, 2020 in PHP by Niroj
• 82,880 points
6,354 views
0 votes
1 answer

How to truncate string in Laravel blade templates?

Hello @kartik, In Laravel 4 & 5 (up ...READ MORE

Oct 6, 2020 in PHP by Niroj
• 82,880 points
6,347 views
0 votes
1 answer

How to log in to phpMyAdmin with WAMP?

Hello @kartik,  Try-Username: root Password: (No password set). Sometimes it doesn't ...READ MORE

Apr 9, 2020 in PHP by Niroj
• 82,880 points
6,286 views
0 votes
1 answer

Error: unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING

Hello @kartik, Make sure they are running Latest ...READ MORE

May 8, 2020 in PHP by Niroj
• 82,880 points
6,177 views
0 votes
1 answer

How to get response using cURL in PHP?

Hello @kartik, Use the below piece of code ...READ MORE

Oct 19, 2020 in PHP by Niroj
• 82,880 points
6,152 views
0 votes
1 answer

How to add custom javascript to WordPress Admin?

Hello, Use the admin_enqueue_scripts action and the wp_enqueue_script method to add custom ...READ MORE

May 8, 2020 in PHP by Niroj
• 82,880 points
6,078 views
0 votes
1 answer

Error: “Input is not proper UTF-8, indicate encoding !” using PHP's simplexml_load_string

Hello, Try this: $content = utf8_encode(file_get_contents('http://example.com/rss.xml')); $xml = simplexml_load_string($content); Hope it ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,880 points
6,072 views
0 votes
1 answer

How do I get all posts from $wp_query in the search results in wordpress?

Hello @kartik, Set posts_per_page parameter in args to ...READ MORE

May 8, 2020 in PHP by Niroj
• 82,880 points
5,965 views
0 votes
1 answer

How do I reload a relation collection in laravel?

You can easily tell laravel to load ...READ MORE

Nov 4, 2020 in PHP by anonymous
• 82,880 points
5,914 views
0 votes
1 answer

How to extract URLs from text in PHP?

Hello, A simple example capturing anything starting with http:// and https:// could ...READ MORE

Nov 20, 2020 in PHP by Niroj
• 82,880 points
5,908 views
0 votes
1 answer

How do I find out my MySQL URL, host, port and username?

Hello @kartik, If you're already logged into the ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,880 points
5,901 views
0 votes
1 answer

Fatal error: Call to undefined function socket_create()

Hello @kartik, For a typical XAMPP install on ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,880 points
5,895 views
0 votes
1 answer

How to auto call function in php for every other function call?

Hii, Your best bet is the magic method __call, ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,880 points
5,894 views
0 votes
1 answer

How do I escape a single quote in SQL Server?

Hello @kartik, Single quotes are escaped by doubling ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
5,853 views
0 votes
1 answer

How to list all tables in PhpMyAdmin's left menu?

Hello @kartik, Go to the phpMyAdmin Home page ...READ MORE

Oct 20, 2020 in PHP by Niroj
• 82,880 points
5,835 views
0 votes
1 answer

Fatal error: Call to undefined function ImageCreate() in /home/t1g01/phplot.php on line 248

Hello @kartik, Your server most like does not ...READ MORE

Nov 18, 2020 in PHP by Niroj
• 82,880 points
5,818 views
0 votes
1 answer

How to generate file for download then redirect using php?

Hii, I don't think this can be done ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,880 points
5,760 views
0 votes
0 answers

How to filter data from a MySQL Database Table with PHP

I'm attempting to code a search box ...READ MORE

Jul 22, 2022 in PHP by narikkadan
• 63,420 points
5,757 views
0 votes
1 answer

How to create a database using PDO in PHP?

Hello @Hitesh, Yes, you can create a database using ...READ MORE

Nov 9, 2020 in PHP by Niroj
• 82,880 points
5,733 views
0 votes
1 answer

How to pass arrays as url parameter?

Hello @kartik, There is a very simple solution: http_build_query(). ...READ MORE

Sep 1, 2020 in PHP by Niroj
• 82,880 points
5,731 views
0 votes
1 answer

How do I see the actual XML generated by PHP SOAP Client Class?

Hello, Use getLastRequest. It returns the XML sent in ...READ MORE

Nov 4, 2020 in PHP by Niroj
• 82,880 points
5,689 views
0 votes
1 answer

How can I include a php file and also send query parameters in php?

Hello, You could do something like this to ...READ MORE

Nov 10, 2020 in PHP by Niroj
• 82,880 points
5,608 views
0 votes
1 answer

How to get Alternative to file_get_contents?

Hii, Use cURL. This function is an alternative to file_get_contents. function ...READ MORE

Nov 9, 2020 in PHP by Niroj
• 82,880 points
5,565 views
0 votes
1 answer

How to view query error in PDO PHP?

Hello, You need to set the error mode ...READ MORE

Oct 20, 2020 in PHP by Niroj
• 82,880 points
5,561 views
0 votes
1 answer

How to check whether property exists in object or class in php?

Hello @kartik, Using  property_exists( mixed $class , string $property ...READ MORE

Oct 1, 2020 in PHP by Niroj
• 82,880 points
5,493 views
0 votes
1 answer

Error:Undefined index: barangay in C:\xampp\htdocs\TextBlast\homepage\insert.php on line 22

Hello @ Regina, First checks whether a variable is ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
5,389 views
0 votes
1 answer

How to write file in UTF-8 format?

Hello @kartik, file_get_contents / file_put_contents will not magically ...READ MORE

Nov 5, 2020 in PHP by Niroj
• 82,880 points
5,385 views
0 votes
1 answer

How can I get the session ID in Laravel?

Hii, Use: $session_id = Session::getId(); or $session_id = ses ...READ MORE

Nov 18, 2020 in PHP by Niroj
• 82,880 points
5,384 views
0 votes
1 answer

Error:Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23

Hello @kartik, This error message gets triggered when anything is ...READ MORE

Sep 16, 2020 in PHP by Niroj
• 82,880 points
5,357 views
0 votes
1 answer

How to solve JSON_ERROR_UTF8 error in php json_decode?

Hello @kartik, You need simple line of code: $input ...READ MORE

Nov 8, 2020 in PHP by Niroj
• 82,880 points
5,244 views
0 votes
0 answers

How to install Imagick/imagemagick PHP extension on windows 7

Installing Image Magic in Windows 7: instructions ...READ MORE

Aug 4, 2022 in PHP by Kithuzzz
• 38,010 points
5,218 views
0 votes
1 answer

How do I let PHP to create subdomain automatically for each user?

Hello @kartik, We setup wildcard DNS like they ...READ MORE

Apr 20, 2020 in PHP by Niroj
• 82,880 points
5,139 views
0 votes
1 answer

Error: Class 'NumberFormatter' not found

Hello @kartik, You just need to enable this ...READ MORE

Nov 16, 2020 in PHP by Niroj
• 82,880 points
5,135 views