- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Malhar Lathkar has Published 189 Articles
Malhar Lathkar
285 Views
IntroductionTraversable is an abstract interface, hence it can not be directly implemented by any class. Generally, Iterator or IteratorAggregate interfaces, which extend Traversable, are used to check if implementing class is traversable using foreach construct in PHP.Certain built-in classes that implement this interface can be used in foreach and need ... Read More
Malhar Lathkar
350 Views
IntroductionIn PHP 7, Throwable interface acts as base for any object that can be a parameter to throw statement, including Error and Exception. Both Error and Exception classes, from which predefined and user defined error and exception classes are derived respectively, implement Throwable interface. Following abstract methods are defined in ... Read More
Malhar Lathkar
374 Views
IntroductionThe Serializable interface is present in PHP library to build a class that provides custimised serialzing. PHP's serialize() function is able to serialize most of the values to a storable representation. However, objects of user defined classes can not be serialized. This interface makes it possible.SyntaxSerializable { /* Methods ... Read More
Malhar Lathkar
324 Views
IntroductionIteratorAggregate interface extends abstract Traversable interface. It is implemented by a class to create external iterator. This interface introduces on abstract method called getIterator.SyntaxIteratorAggregate extends Traversable { /* Methods */ abstract public getIterator ( void ) : Traversable }MethodsIteratorAggregate::getIterator — Retrieve an external iteratorThis function has no parameters and ... Read More
Malhar Lathkar
690 Views
IntroductionIterator interface extends abstract Traversable interface. PHP provides many built-in iterators (called SPL iterators) for many routine functionalities. Examples are ArrayIterator, DirectoryIterator etc. A user class that implements Iterator interface should implement abstract methods as defined in it.SyntaxIterator extends Traversable { /* Methods */ abstract public current ( void ... Read More
Malhar Lathkar
567 Views
IntroductionTraversing a big collection of data using looping construct such as foreach would require large memory and considerable processing time. With generators it is possible to iterate over a set of data without these overheads. A generator function is similar to a normal function. However, instead of return statement in ... Read More
Malhar Lathkar
1K+ Views
IntroductionAnonymous functions (also called lambda) return object of Closure class. This class has some additional methods that provide further control over anonymous functions.SyntaxClosure { /* Methods */ private __construct ( void ) public static bind ( Closure $closure , object $newthis [, mixed $newscope = "static" ] ... Read More
Malhar Lathkar
113 Views
IntroductionIn PHP, ArrayAccess interface is used to develop a class that provides array like access to one of properties which is an array. Such array property may be manipulated without exposing it during object creation. ArrayAccess interface defines following abstract methodsSyntaxArrayAccess { /* Methods */ abstract public offsetExists ... Read More
Malhar Lathkar
366 Views
IntroductionPHP parser throws ArgumentCountError when arguments passed to a user defined function or method are less than those in its definition. ArgumentCountError class is inherited from TypeError classArgumentCountError ExampleIn Following example, a user defined function add() is defined to receive two arguments. However, if less than required number of arguments ... Read More
Malhar Lathkar
149 Views
IntroductionArithmeticError class is inherited from Error class. This type of error may occurwhile performing certain mathemetical operations. One such scenario is attempt to perform bitwise shift operation by negative amount. This error is also thrown when call to intdiv() function results in value such that it is beyond legitimate boundaries of ... Read More