Trending questions in PHP

0 votes
1 answer

How foreach change original array values in php?

Hello @kartik, Do the following: foreach ($fields as $key ...READ MORE

Aug 14, 2020 in PHP by Niroj
• 82,880 points
8,177 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 MySQL date format DD/MM/YYYY select query?

Hello @kartik, You can use STR_TO_DATE() to convert your strings ...READ MORE

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

How to zip a whole folder using PHP?

Hello @kartik, You can Zip a whole folder using ...READ MORE

Aug 24, 2020 in PHP by Niroj
• 82,880 points
7,594 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,588 views
0 votes
1 answer

How to convert a string to JSON object in PHP?

Hello @kartik, it seems that your JSON is ...READ MORE

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

How to check if memcache or memcached is installed for PHP?

Hii, You can look at phpinfo() or check ...READ MORE

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

PHP Warning Permission denied (13) on session_start()

Hello @kartik, You don't appear to have write ...READ MORE

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

How to convert timestamp to date in MySQL query?

Hello @kartik, Try this: DATE_FORMAT(FROM_UNIXTIME(`user.registration`), '%e %b %Y') AS ...READ MORE

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

How to allow duplicate keys in php array?

Hello @kartik, You could have a single key ...READ MORE

Nov 19, 2020 in PHP by Niroj
• 82,880 points
3,493 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 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,588 views
0 votes
1 answer

How to show an alert box in PHP?

Hello, use this code echo '<script language="javascript">'; echo 'alert("message successfully ...READ MORE

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

How to import all classes from another namespace in PHP?

Hello @kartik, This is not possible in PHP. All ...READ MORE

Oct 20, 2020 in PHP by Niroj
• 82,880 points
4,677 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 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,404 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

Fatal error: Call to undefined function mysql_connect()

Hello @kartik, You upgraded to PHP 7, and ...READ MORE

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

How can I ping a server port with PHP?

Hello @kartik, Test different ports: $wait = 1; // ...READ MORE

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

How to remove a child with a specific attribute, in SimpleXML for PHP?

Hii, Just unset the node: $str = <<<STR <a> ...READ MORE

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

How to check if multiple array keys exists?

Hello @kartik, If you only have 2 keys ...READ MORE

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

How do I remove a directory that is not empty?

Hello, Try this code: function rrmdir($dir) { if (is_dir($dir)) { ...READ MORE

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

How to Creat a folder when I run file_put_contents()?

Hello @kartik, file_put_contents() does not create the directory structure. ...READ MORE

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

How can I explode and trim whitespace?

Hello @kartik, You can do the following using array_map: $new_arr ...READ MORE

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

How to check if a file exists from a url using php?

Hello, You have to use CURL function does_url_exists($url) { ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,880 points
3,585 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 route GET and POST for same pattern in Laravel?

Hello @kartik, You could try the following: Route::controller('login','AuthController'); Then in ...READ MORE

Nov 22, 2020 in PHP by Niroj
• 82,880 points
2,699 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,586 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

How to pass arguments to an included file?

Hello @kartik, Include has the scope of the ...READ MORE

Nov 20, 2020 in PHP by Niroj
• 82,880 points
2,748 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 5, 2020 in PHP by Niroj
• 82,880 points
3,405 views
0 votes
1 answer

How to check if row is soft-deleted in Eloquent?

Hello, Try this: if ($thing->trashed()) { ... } READ MORE

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

How to get the home directory from a PHP CLI script?

Hello @kartik, You can fetch the value of ...READ MORE

Nov 3, 2020 in PHP by Niroj
• 82,880 points
3,397 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

PHP Error: Function name must be a string

Hello @kartik, It should be $_COOKIE['name'], not $_COOKIE('name') $_COOKIE is an array, ...READ MORE

Nov 4, 2020 in PHP by Niroj
• 82,880 points
3,318 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

How to set time zone in codeigniter?

Hii, Add this line inside the main index.php of codeigniter ...READ MORE

Nov 6, 2020 in PHP by Niroj
• 82,880 points
3,210 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,394 views
0 votes
1 answer

How to verify if $_GET exists?

You can use isset function: if(isset($_GET['id'])) { ...READ MORE

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

How to get the http headers from current request in PHP?

Hello, Try this code: if (!function_exists('getallheaders')) { ...READ MORE

Nov 23, 2020 in PHP by Niroj
• 82,880 points
2,417 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 check if a string is an email address in PHP?

Hello, Try this without regular expressions: <?php ...READ MORE

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

Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

Hello @kartik, To evaporate the warning, you can ...READ MORE

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

How to escape strings in SQL Server using PHP?

Hello @kartik, addslashes() isn't fully adequate, but PHP's mssql ...READ MORE

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

How to check an IP address is within a range of two IPs in PHP?

Hello @kartik, With ip2long() it's easy to convert your addresses ...READ MORE

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

How do I make a PHP form that submits to self?

Hello @kartik, The proper way would be to ...READ MORE

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

How can I enable the MySQLi extension in PHP 7?

Hello @kartik, The problem is that the package ...READ MORE

Oct 30, 2020 in PHP by Niroj
• 82,880 points
3,304 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,868 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

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