Trending questions in PHP

0 votes
1 answer

How to remove all special characters from a string?

Hello @kartik, This should do what you're looking ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,880 points
10,605 views
0 votes
1 answer

How to convert multidimensional array into single array?

Hello, This single line would do that: $array = ...READ MORE

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

How to print all session variables currently set?

Hello @kartik, Use this: echo '<pre>'; var_dump($_SESSION); echo '</pre>'; Or you can ...READ MORE

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

Error: The mbstring extension is missing. Please check your PHP configuration

Hii, Edit the php.ini file: change extension_dir = "ext" into extension_dir = "D:\php\ext" (please write ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,880 points
8,203 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,050 views
0 votes
1 answer

How to delete all cookies of my website in php?

Hello @kartik, This will unset all of the ...READ MORE

Oct 27, 2020 in PHP by Niroj
• 82,880 points
7,782 views
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,435 views
0 votes
1 answer

How to remove MySQL root password?

Hello @kartik, You need to set the password ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,880 points
10,701 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,575 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,682 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,072 views
0 votes
1 answer

How to include a PHP variable inside a MySQL statement?

Hii, You can try this: $query="SELECT * FROM CountryInfo ...READ MORE

Apr 9, 2020 in PHP by Niroj
• 82,880 points
15,783 views
–1 vote
1 answer

Error:Notice: Array to string conversion in C:\xampp\htdocs\Niroj\FinalSubmissionOfTheFormPHP.php on line 8

Hello @kartik, When you have many HTML inputs ...READ MORE

Aug 27, 2020 in PHP by Niroj
• 82,880 points
9,735 views
0 votes
1 answer

How do I make a PATCH request in PHP using cURL?

Hello @kartik, Use this: curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'PATCH'); should do it. Hope ...READ MORE

Oct 19, 2020 in PHP by Niroj
• 82,880 points
7,432 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,910 views
0 votes
1 answer

Error:Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF.

Hello @kartik, You're inserting values for OperationId that is an identity ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,880 points
11,061 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,117 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 do I get the HTML code of a web page in PHP?

Hello @kartik, If your PHP server allows url ...READ MORE

Oct 6, 2020 in PHP by Niroj
• 82,880 points
7,659 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,586 views
0 votes
1 answer

How to call a php function from ajax?

Hello @kartik, You can't call a PHP function ...READ MORE

Jun 16, 2020 in PHP by Niroj
• 82,880 points
12,242 views
0 votes
1 answer

Composer install error - requires ext_curl when it's actually enabled?

Hello, on php7 run for example: > sudo apt-get ...READ MORE

Apr 2, 2020 in PHP by Niroj
• 82,880 points
15,334 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,385 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,735 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,917 views
0 votes
1 answer

Error:“Connection for controluser as defined in your configuration failed” with phpMyAdmin in XAMPP

Hii, I edited /etc/phpmyadmin/config.inc.php and changed the following ...READ MORE

Apr 20, 2020 in PHP by Niroj
• 82,880 points
14,420 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 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

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 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,566 views
0 votes
1 answer

How do you Encrypt and Decrypt a PHP String?

Hello @kartik, Use openssl_encrypt and openssl_decrypt You can do something like: $string_to_encrypt="Test"; $password="password"; $encrypted_string=openssl_encrypt($string_to_encrypt,"AES-128-ECB",$password); $decrypted_string=openssl_decrypt($encrypted_string,"AES-128-ECB",$password); Hope it ...READ MORE

Sep 14, 2020 in PHP by Niroj
• 82,880 points
7,927 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,691 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,895 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,136 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
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,154 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
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,387 views
0 votes
1 answer

Php exec() not returning error message in output

Hello @kartik, You need to capture the stderr too. Redirecting stderr to stdout should do ...READ MORE

Nov 18, 2020 in PHP by Niroj
• 82,880 points
4,616 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,836 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,349 views
0 votes
1 answer

Error:Trying to get property of non-object in C:\wamp\www\ni\pages\init.php..

Hello, Try mysql_fetch_object(). It returns an object, not an ...READ MORE

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

How to check if a string is JSON or not?

Hello @kartik, Use JSON.parse function isJson(str) { ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,880 points
8,285 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,562 views
0 votes
1 answer

How to write CDATA using SimpleXmlElement?

Hello @kartik, Try this: class MySimpleXMLElement extends SimpleXMLElement{ ...READ MORE

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

How to skip tests in PHPunit?

Hello, The fastest and easiest way to skip ...READ MORE

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

How to set a default attribute value for a Laravel / Eloquent model?

Hello @kartik, This is what I'm doing now: protected ...READ MORE

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

Fatal error: Call to undefined function imap_open() in PHP

Hello @kartik, In Ubuntu for install imap use sudo ...READ MORE

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

How to find out the MySQL root password

Hello @kartik, Follow these steps to reset password ...READ MORE

Aug 26, 2020 in PHP by Niroj
• 82,880 points
7,791 views
0 votes
1 answer

How to pass an array via $_GET in php?

Hii, You can pass an associative array to http_build_query() and ...READ MORE

Nov 22, 2020 in PHP by Niroj
• 82,880 points
3,854 views