
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
617 Views
Following is the code to create a full screen search box with CSS and JavaScript −Example Live Demo body { font-family: Arial; } * { box-sizing: border-box; } .showBtn { background: #008b0c; border: none; color:white; padding: 10px 15px; font-size: 20px; ... Read More

AmitDiwan
739 Views
Following is the code to create a form with icons −Example Live Demo body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } * { box-sizing: border-box; } h1 { text-align: center; } form { max-width: 500px; margin: auto; } .fieldContainer ... Read More

AmitDiwan
486 Views
Following is the code to create a contact form using CSS −Example Live Demo * {box-sizing: border-box;} body{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; } label{ font-size: 15px; } input[type=text], textarea { width: 100%; padding: 12px; border: 1px solid #ccc; ... Read More

AmitDiwan
782 Views
The same syntax used by is_callable and call_user_func can be used to pass static methods as arguments in PHP.To pass the static method, the below example can be used −Example Live Demo OutputThis will produce the following output −bool(true) my_func bool(true)

AmitDiwan
844 Views
The Reflection API can be used to pass arguments from array to constructor.ReflectionClass::newInstanceArgsThe above line creates a new class instance from given arguments −public ReflectionClass::newInstanceArgs ([ array $args ] ) : objectIt creates a new instance of the class when the arguments are passed to the constructor. Here, args refers ... Read More

AmitDiwan
1K+ Views
The domain name can be validated using the below code in PHP −Example Live Demo $domain_name = 'https://tutorialspoint.com' is_valid_domain_name($domain_name)OutputThis will produce the following output −$domain_name = 'https://tutorialspoint.com' is_valid_domain_name($domain_name)In the above code, the ‘preg_match’ function is used to match the domain_name passed as an argument to the user-defined function ‘is_valid_domain_name’.Read More

AmitDiwan
286 Views
To install Imagick or Imagemagick on windows, follow the below mentioned procedure −Check the permissions on the .dll file. This will make sure that the Apache user has read access to the file.It is better to change the permission of the [PHP]/extension directory.In order to change the permission, follow the ... Read More

AmitDiwan
2K+ Views
The memory_get_usage() function can be caked before and after allocating memory to the class created.class MyBigClass { var $allocatedSize; var $allMyOtherStuff; } function AllocateMyBigClass() { $before = memory_get_usage(); $ret = new MyBigClass; $after = memory_get_usage(); $ret->allocatedSize = ($after - $before); return $ret; }Output ... Read More

AmitDiwan
1K+ Views
In PHP version 5.3, methods of objects in array can be called using the below code −$props = array_map(function($obj){ return $obj->getProp(); }, $objs);This will be slower than a ‘for’ loop since it invokes one function for every element −function map($obj) { return $obj->getProperty(); } $props = array_map('map', $objs);Alternatively, for ... Read More

AmitDiwan
1K+ Views
The short answer is no. POST/GET values are never null. The best they can be is an empty string, which can then be converted to null/'NULL' −Example Live Demoif ($_POST['value'] === '') { $_POST['value'] = null; } echo'Null assigned';OutputThis will produce the following output −Null assigned