Most answered questions in PHP

0 votes
1 answer

How do I save value in my own session variable in Magento?

Hello @kartik, Try this: $session = Mage::getSingleton("core/session", array("name"=>"frontend")); // ...READ MORE

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

mysql error 'TYPE=MyISAM'

Hello @kartik, Replace TYPE=MyISAM with ENGINE=MyISAM The problem was "TYPE=MyISAM" which should ...READ MORE

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

How do I remove quotes from a string?

Hello @kartik, Try this: str_replace('"', "", $string); str_replace("'", "", $string); Otherwise, ...READ MORE

Nov 16, 2020 in PHP by Niroj
• 82,880 points
17,555 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,208 views
0 votes
1 answer

How do I embed PHP code in JavaScript?

Hello @kartik, If your whole JavaScript code gets ...READ MORE

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

How to embed a .png image into an html page?

Hello @kartik, Try this: div.image { width:100px; ...READ MORE

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

How to find Object ID in PHP?

Hello @kartik, Use spl_object_hash() for that. It returns an unique identifier ...READ MORE

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

Error: Call to undefined function money_format()

Hello @kartik, If you are using windows based ...READ MORE

Nov 16, 2020 in PHP by Niroj
• 82,880 points
2,521 views
0 votes
1 answer

How do I find the mime-type of a file with php?

Hello @kartik, mime_content_type() is deprecated, so you won't ...READ MORE

Nov 16, 2020 in PHP by Niroj
• 82,880 points
2,526 views
0 votes
1 answer

How do I save value in my own session variable in Magento?

Hello @kartik, Let's say you want to save ...READ MORE

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

Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=MyISAM' at line 9

Hello @kartik, Replace TYPE=MyISAM with ENGINE=MyISAM The problem was "TYPE=MyISAM" which should ...READ MORE

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

How can I get PHP to produce a backtrace upon errors?

Hello @kartik, This is how you do it: set_error_handler(function($errorType){ ...READ MORE

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

How to return an array from an AJAX call?

Hello @kartik, Use JSON to transfer data types (arrays and ...READ MORE

Nov 14, 2020 in PHP by Niroj
• 82,880 points
16,454 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,685 views
0 votes
1 answer

How to get request string without GET arguments?

Hello @kartik, You can use $_SERVER['REQUEST_URI'] to get requested path. ...READ MORE

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

How to echo a MySQLi prepared statement?

Hello @kartik, I don't think you can - ...READ MORE

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

Error: Premature end of script headers: backup.php

Hello @kartik< Try this settings on my apache.conf: <VirtualHost ...READ MORE

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

How to set max_execution_time in PHP CLI?

Hello, set_time_limit() works in CLI scripts. <?php set_time_limit(1); //in ...READ MORE

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

What are the proper permissions for an upload folder with PHP/Apache?

Hello @kartik, You can create a new group ...READ MORE

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

How to enable PHP support in Netbeans?

Hello @kartik, Go to Tools->Plugins. In the Settings tab ensure that the ...READ MORE

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

How to discard a variable from a PHP session array

Hello, Try this: if (isset($_POST['remove'])) { ...READ MORE

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

Error: Class'Illuminate\Foundation\Application' not found

Hii, Use the --no-scripts flag to prevent artisan from executing ...READ MORE

Nov 13, 2020 in PHP by Niroj
• 82,880 points
2,416 views
0 votes
1 answer

Error: Field 'display_name' doesn't have a default value

Hello @kartik, MySQL is most likely in STRICT ...READ MORE

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

Error:invalid address: @invalid@email You must provide at least one recipient email address.

Hello, PHPMailer uses Exceptions. Try the following code: require_once '../class.phpmailer.php'; $mail = new ...READ MORE

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

How to save DOMPDF generated content to file?

Hii, Try this: require_once("./pdf/dompdf_config.inc.php"); $files = glob("./pdf/include/*.php"); foreach($files as $file) include_once($file); $html ...READ MORE

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

How to store IP in database using php?

Hello @kartik, Store the ip as a INT(11) UNSIGNED, ...READ MORE

Nov 13, 2020 in PHP by Niroj
• 82,880 points
1,931 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,749 views
0 votes
1 answer

How can I use PHP to check if a directory is empty?

Hello @kartik, It seems that you need scandir instead of ...READ MORE

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

How can I loop through all the properties of object using php?

Hello @kartik, If this is just for debugging ...READ MORE

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

Error:Add myBundle to the asseticBundle config symfony2 exception?

Hello @kartik, Try the below steps: edit app/config/config.yml then go to assetic: under ...READ MORE

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

How can I access Laravel .env variables in blade?

Hii @kartik, Try to implement this: @if (env('APP_ENV')!='Production') Enviroment Test @endif Hope ...READ MORE

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

How to check if a string contains a specific text using php?

Hello @kartik, Use the strpos function:  $haystack = "foo bar baz"; $needle ...READ MORE

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

How can one check to see if a remote file exists using PHP?

Hello @kartik, You can instruct curl to use ...READ MORE

Nov 10, 2020 in PHP by Niroj
• 82,880 points
962 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,691 views
0 votes
1 answer

How to access array returned by a function in php?

Hello @kartik, Since PHP 5.4 it's possible to ...READ MORE

Nov 10, 2020 in PHP by anonymous
• 82,880 points
683 views
0 votes
1 answer

How to load return array from a PHP file?

Hii @kartik, When an included file returns something, ...READ MORE

Nov 10, 2020 in PHP by Niroj
• 82,880 points
2,765 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,725 views
0 votes
1 answer

How to display errors for my MySQLi query?

Hii, Use mysqli_error() As in: $sql = "Your SQL statement ...READ MORE

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

How to change public folder to public_html in laravel 5?

Hello @kartik, go to this address : /app/Providers/AppServiceProvider.php and append ...READ MORE

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

How to embed PHP code in JavaScript?

Hello, If your whole JavaScript code gets processed ...READ MORE

Nov 9, 2020 in PHP by anonymous
• 82,880 points
755 views
0 votes
1 answer

How to write CSV To File Without Enclosures In PHP?

Hello @kartik, The warnings about foregoing enclosures are ...READ MORE

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

How to get the files inside a directory?

Hello @kartik, There's a lot of ways. The ...READ MORE

Nov 9, 2020 in PHP by Niroj
• 82,880 points
347 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,805 views
0 votes
1 answer

How do check if a PHP session is empty?

Hii, I would use isset and empty: session_start(); if(isset($_SESSION['blah']) && !empty($_SESSION['blah'])) { ...READ MORE

Nov 9, 2020 in PHP by Niroj
• 82,880 points
8,812 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,625 views
0 votes
1 answer

How to enable mysqlnd for php?

Hello, The ./configure command is part of the compilation process ...READ MORE

Nov 8, 2020 in PHP by Niroj
• 82,880 points
2,509 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,707 views
0 votes
1 answer

How to return an array from an AJAX call?

Hello, Php has a function for this, just ...READ MORE

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

How to remove a variable from a PHP session array?

Hello @kartik, Try: if (isset($_POST['remove'])) { ...READ MORE

Nov 8, 2020 in PHP by Niroj
• 82,880 points
4,378 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,344 views