
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
2K+ Views
To generate all combinations of a specific size from a single set, the code is as follows −Example Live Demofunction sampling($chars, $size, $combinations = array()) { # in case of first iteration, the first set of combinations is the same as the set of characters if (empty($combinations)) { ... Read More

AmitDiwan
485 Views
Yes, debuggers like XDebug reduce the performance of the PHP server. This is the reason why debuggers are not placed in server environment. They are deployed in a different environment to avoid unnecessary overheads.Debug messages can’t be displayed in an application that is already in the production phase.When debugging behavior ... Read More

AmitDiwan
426 Views
The regular expression [\S\s]* in PHP means “don’t match new lines”.In PHP, the /s flag can be used to make the dot match all the characters −Example Live Demoprint(preg_match('/^[\S\s]$/s', "hello world"));OutputThis will produce the following output −0The ‘preg_match’ function is used to match regular expression with the given input string. ... Read More

AmitDiwan
1K+ Views
The zipped files can be unzipped or decompressed using PHP’s gzread function. Below is the code example for the same −Example$file_name = name_of/.dump.gz'; $buffer_size = 4096; // The number of bytes that needs to be read at a specific time, 4KB here $out_file_name = str_replace('.gz', '', $file_name); $file = gzopen($file_name, ... Read More

AmitDiwan
292 Views
The main reason behind websites being slow is overloading of hosts.The benefit of using PHP over other compiled languages is the ease of maintenance. PHP has been designed ground up to efficiently handle HTTP traffic, there is less to build in comparison to building using other compiled languages. In addition ... Read More

AmitDiwan
623 Views
The json_encode function can be used to add slashes to double quotes. Also ‘addcslahses’ can also be used to add ‘\’ to specific characters −Example Live DemoOutputThis will produce the following output −Hello \there!The ‘addcslashes’ function is used to return a string with backslashes in front of the specific characters. It ... Read More

AmitDiwan
2K+ Views
The GeoIP extension can be used to find the exact location of an IP address. Apart from this, the geoPlugin class can be downloaded from −https://www.geoplugin.com/_media/webservices/geoplugin.class.phpsThe country code list can be found in the below link −https://www.geoplugin.com/iso3166An index.php file can be placed inside the root folder and the below lines ... Read More

AmitDiwan
4K+ Views
The unset function can be used to remove array object from a specific index in PHP −Example Live Demo$index = 2; $objectarray = array( 0 => array('label' => 'abc', 'value' => 'n23'), 1 => array('label' => 'def', 'value' => '2n13'), 2 => array('label' => 'abcdef', 'value' => 'n214'), ... Read More

AmitDiwan
3K+ Views
The file_get_contents function takes the name of the php file and reads the contents of the text file and displays it on the console. get the contents, and echo it out.The contents of filename.php would be the output.In the above code, the function ‘file_get_contents’ is called by passing the php ... Read More

AmitDiwan
2K+ Views
If the string is pre-formatted, and a plain text representation of the same is needed, it can be wrapped in a HTML tag and html entities can be used to escape the angle brackets. This has been shown below −The string is assigned to a string type and the ... Read More