Trending questions in PHP

0 votes
1 answer

In PHP, how to detect the execution is from CLI mode or through browser ?

Hello @kartik, Use the php_sapi_name() function. if (php_sapi_name() == "cli") { ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
1,443 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,840 points
491 views
0 votes
1 answer

How to delete from multiple tables in MySQL?

Hello @kartik, Use a JOIN in the DELETE statement. DELETE p, pa ...READ MORE

Aug 26, 2020 in PHP by Niroj
• 82,840 points
3,864 views
0 votes
1 answer

How do I dynamically invoke a class method in PHP?

Hello @kartik, It works both ways - you ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,840 points
858 views
0 votes
1 answer

How to submit form without page reloading?

Hello @kartik, If you put an Iframe in ...READ MORE

Oct 6, 2020 in PHP by Niroj
• 82,840 points
2,049 views
+1 vote
2 answers

How to make asynchronous HTTP requests in PHP?

Hello @kartik, Use this code: function post_without_wait($url, $params) { ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,840 points
2,666 views
0 votes
1 answer

How to set upload_max_filesize in .htaccess?

Hello @kartik, php_value upload_max_filesize 30M is correct. You will have ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
1,323 views
0 votes
1 answer

How to save MySQL query output to excel or .txt file?

Hello @kartik, You can write following codes to ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,840 points
4,032 views
0 votes
1 answer

How can I get the classname from a static call in an extended PHP class?

Hello @kartik, __CLASS__ always returns the name of the ...READ MORE

Oct 27, 2020 in PHP by Niroj
• 82,840 points
1,072 views
0 votes
1 answer

How to prevent my site page to be loaded via 3rd party site frame of iFrame?

Hello @kartik, You cannot check it from the ...READ MORE

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

How to display HTML tags as plain text ?

Hello @kartik, Replace < with &lt; and& ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,840 points
2,771 views
0 votes
1 answer

How to properly indent PHP/HTML mixed code?

The PHP and the HTML should each ...READ MORE

Oct 29, 2020 in PHP by Niroj
• 82,840 points
955 views
0 votes
1 answer

How to change public folder to public_html in laravel 5?

Hello, you can register the following code at Application ...READ MORE

Nov 6, 2020 in PHP by Niroj
• 82,840 points
599 views
0 votes
1 answer

How to generate .json file with PHP?

Hello @kartik, Here is a sample code: <?php $sql="select ...READ MORE

Sep 15, 2020 in PHP by Niroj
• 82,840 points
2,813 views
0 votes
1 answer

How do I receive email and process it in a web application?

Use procmail if it is installed on ...READ MORE

Nov 4, 2020 in PHP by Niroj
• 82,840 points
640 views
0 votes
1 answer

How to get innerHTML of DOMNode?

Hello @kartik, Here is a version in a functional ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
1,195 views
0 votes
1 answer

Notice: Undefined index: bid in C:\xampp\htdocs\userac\courier_management_system-master\courier_management_system-master\addstaff.php on line 130

Hello @saima , Before you extract values from $_POST ,$_SESSION, ...READ MORE

Sep 14, 2020 in PHP by Niroj
• 82,840 points
2,881 views
0 votes
1 answer

How to Initializing Multiple PHP Variables Simultaneously?

Hello @kartik, Simply try this: $first = $second = ...READ MORE

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

How to get Real IP from Visitor?

Hello @kartik, Try this php code. <?PHP function getUserIP() { ...READ MORE

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

How to make form_rest() not display a field with Symfony2?

Hello @kartik, Another option is to explicitly mark ...READ MORE

Oct 20, 2020 in PHP by Niroj
• 82,840 points
1,251 views
0 votes
1 answer

How to remove duplicate values from an array in PHP?

Hello @kartik, Use array_unique(): Example: $array = array(1, 2, 2, 3); $array ...READ MORE

Sep 15, 2020 in PHP by Niroj
• 82,840 points
2,758 views
0 votes
1 answer

How to parse JSON and access results?

Hello, Try: $result = curl_exec($cURL); $result = json_decode($result,true); Now you can ...READ MORE

Nov 4, 2020 in PHP by Niroj
• 82,840 points
560 views
0 votes
1 answer

How to create an interface composed of other interfaces?

Hello, You are looking for the extends keyword: Interface IFoo extends ...READ MORE

Nov 5, 2020 in PHP by Niroj
• 82,840 points
506 views
0 votes
2 answers

How to copy a file from one directory to another using PHP?

Simply, $source = 'Source_file_location' ...READ MORE

Oct 12, 2020 in PHP by anonymous
• 140 points
1,704 views
0 votes
1 answer

How to get current PHP page name?

Hello @kartik, You can use basename() and $_SERVER['PHP_SELF'] to get current page ...READ MORE

Aug 28, 2020 in PHP by Niroj
• 82,840 points
3,462 views
0 votes
1 answer

How to execute PHP code from the command line?

Hello @kartik, the php command offers two switches to ...READ MORE

Oct 1, 2020 in PHP by Niroj
• 82,840 points
1,921 views
0 votes
1 answer

How to execute a MySQL command from a shell script?

Hello @kartik, You need to use the -p flag to ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,840 points
3,716 views
0 votes
1 answer

Invalid argument supplied for foreach() on line 25. Error in my php and mysql

Hello @viven , This should be a simple fix ...READ MORE

Aug 4, 2020 in PHP by Niroj
• 82,840 points
4,355 views
0 votes
1 answer

How do you create optional arguments in php?

Hello @kartik, Use an equals (=) sign in ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,840 points
2,444 views
0 votes
1 answer

How to get the location from an IP address?

Hello @kartik, You could download a free GeoIP ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,840 points
2,423 views
0 votes
1 answer

Catchable fatal error: Argument 1 passed to ClassA::method_a() must be an instance of ClassB, instance of ClassWrong given..

Hello @kartik, This is not a catchable fatal ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
844 views
0 votes
1 answer

How to access class constants in Twig?

Hello @kartik, Try this: {% if var == constant('Namespace\\Entity::TYPE_PERSON') ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,840 points
3,412 views
0 votes
1 answer

How do I add PHP code/file to HTML(.html) files?

Hello @kartik, You can't run PHP in .html ...READ MORE

Oct 22, 2020 in PHP by Niroj
• 82,840 points
687 views
0 votes
2 answers

How to override trait function and call it from the overridden function?

instead of: return traitcalc($v); use this: ...READ MORE

Dec 13, 2020 in PHP by Uncle Nick
3,740 views
0 votes
1 answer

How to creat and Update Laravel Eloquent?

Hello @kartik, Here's a full example of what ...READ MORE

Oct 19, 2020 in PHP by Niroj
• 82,840 points
736 views
0 votes
1 answer

How to Convert timestamp to readable date/time PHP?

Hello @kartik, Use PHP's date() function. Example: echo date('m/d/Y', 1299446702); Hope it helps!! Thank ...READ MORE

Sep 14, 2020 in PHP by Niroj
• 82,840 points
2,202 views
0 votes
1 answer

How to delete element by value in array (not key) using php?

Hello @kartik, Using array_search() and unset, try the following: if (($key = ...READ MORE

Sep 16, 2020 in PHP by Niroj
• 82,840 points
2,114 views
0 votes
1 answer

How can I use Sockets.io on the client side and communicate with a PHP based application on the server?

Hello @kartik, For 'long-lived connection' , you can ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,840 points
3,072 views
0 votes
1 answer

How to use PHP's password_hash to hash and verify passwords?

Hello @kartik, Using password_hash is the recommended way to store ...READ MORE

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

Error:No Application Encryption Key Has Been Specified

Hello @kartik, Open command prompt in the root ...READ MORE

Jul 22, 2020 in PHP by Niroj
• 82,840 points
4,471 views
0 votes
1 answer

How can I select and upload multiple files with HTML and PHP using HTTP POST?

Hello @kartik, This is possible in HTML5. Example (PHP ...READ MORE

Sep 15, 2020 in PHP by Niroj
• 82,840 points
2,021 views
0 votes
1 answer

How to convert PHP code to MySQL query to CSV?

Hello @kartik, Try this: SELECT * INTO OUTFILE "c:/mydata.csv" FIELDS ...READ MORE

Aug 20, 2020 in PHP by Niroj
• 82,840 points
3,123 views
0 votes
1 answer

How to Insert multiple rows in a single SQL query?

Hello @kartik, In SQL Server you can insert ...READ MORE

Jul 21, 2020 in PHP by Niroj
• 82,840 points
4,411 views
0 votes
1 answer

How do I disable the views caching?

Hello @kartik, There is now a php artisan view:clear command ...READ MORE

Oct 1, 2020 in PHP by Niroj
• 82,840 points
1,293 views
0 votes
1 answer

How to get WordPress post featured image URL?

Hello @kartik, Try this code below: <?php if (has_post_thumbnail( $post->ID ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,840 points
3,327 views
0 votes
1 answer

How to move columns in a MySQL table?

Hello @kartik, If empName is a VARCHAR(50) column: ALTER ...READ MORE

Aug 19, 2020 in PHP by Niroj
• 82,840 points
3,120 views
0 votes
1 answer

How to get the request parameters in symfony2

Hello @kartik, The naming is not all that ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,840 points
3,192 views
0 votes
1 answer

How to trigger XDebug profiler for a command line PHP script?

Hello @kartik, You can pass INI settings with ...READ MORE

Sep 17, 2020 in PHP by Niroj
• 82,840 points
1,691 views