
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
Programming Articles - Page 2565 of 3366

9K+ Views
In this article, we will learn to validate an email with PHP regular expression. We will learn different methods to validate email address in PHP.Method1The function preg_match() checks the input matching with patterns using regular expressions.Example Live DemoOutputValid email address.In the above example PHP preg_match() function has been used to search string for a pattern and PHP ternary operator has been used to return the true or false value based on the preg_match return.Method 2We will discuss email validation using filter_var() method.Example Live DemoOutputpattrick@tutorialspoint.com is a valid email addressRead More

3K+ Views
Output Buffering is a method to tell the PHP engine to hold the output data before sending it to the browser. As we know PHP sent the output data to the browser in pieces, but if we utilize the output buffering mechanism, the output data is stored in a variable and sent to the browser as one piece at the end of the script.ExampleLet's demonstrate with a simple example. Live DemoOutputstring(5) "Hello" string(20) "HelloTutorials Point"ExplanationIn the above example ob_get_contents() grabs all of the data gathered since we called ob_start, i.e. everything in the buffer. After that send the output data at ... Read More

3K+ Views
We can remove non-alphanumeric characters from the string with preg_replace() function in PHP. The preg_replace() function is an inbuilt function in PHP which is used to perform a regular expression for search and replace the content.syntaxpreg_replace(pattern, replacement, subject, limit, count )Let's discuss the parameters of the function underneath.patternThis parameter contains the pattern to search for.replacementIt is a mandatory parameter. This parameter may contain a string or an array with strings to replace.subjectThe string or an array with strings to search and replace.limitThe maximum possible replacements for each pattern in each subject stringcountThis is an optional parameter, if specified then this ... Read More

10K+ Views
Yes, we can declare a try-catch block within another try-catch block in Java, this is called nested try-catch block. The try-catch block is used to handle runtime errors that occur during the execution of a program, and the process of handling these errors is called exception handling. The runtime errors or exceptions must be handled in order to maintain the normal flow ofaJava program. Try-Catch Block in Java In a try-catch block, the code that might throw an exception should be placed or written within a try block. The catch block is used to handle the exception that is thrown from ... Read More

8K+ Views
No, we cannot declare a top-level class as private or protected. It can be either public or default (no modifier). If it does not have a modifier, it is supposed to have a default access.Syntax// A top level class public class TopLevelClassTest { // Class body }If a top-level class is declared as private the compiler will complain that the modifier private is not allowed here. This means that a top-level class cannot be a private, the same can be applied to protected access specifier also.Protected means that the member can be accessed by any class in the same ... Read More

839 Views
Yes, we can access the local final variables using the method local inner class because the final variables are stored on the heap and live as long as the method local inner class object may live.Method Local Inner ClassA local inner class instance can be delivered as an argument and retrieved from the methods and it is available inside a valid scope.The only limitation in method local inner class is that a local parameter can be executed only when it is defined as final.The method executing the local parameters can be called after the execution of the method, within which the local inner ... Read More

334 Views
In Java, ArrayStoreException is a public class that extends the RuntimeException class of the java.lang package. It is thrown by the Java Virtual Machine when a runtime error occurs. Since it is an unchecked exception, it does not require an explicit declaration in a method or a constructor's throws clause. Let's understand why the ArrayStoreException is thrown and how we can avoid it. Reason for ArrayStoreException in Java As mentioned earlier, ArrayStoreException is an unchecked exception, and it can occur when we try to store an object of one type in an array of a different type. Usually, one would ... Read More

1K+ Views
Yes, Python supports polymorphism. The word polymorphism means having many forms. Polymorphism is an important feature of class definition in Python that is utilised when you have commonly named methods across classes or sub classes. Polymorphism can be carried out through inheritance, with sub classes making use of base class methods or overriding them. There are two types of polymorphism Overloading Overriding Overloading Overloading occurs when two or more methods in one class have the same method name but different parameters. Overriding Overriding means having two methods with the same method name and parameters (i.e., method signature). One ... Read More

4K+ Views
Yes, Python supports multiple inheritance. Like C++, a class can be derived from more than one base classes in Python. This is called Multiple Inheritance. In multiple inheritance, the features of all the base classes are inherited into the derived class. Let us see the syntax − Syntax Class Base1: Body of the class Class Base2: Body of the class Class Base3: Body of the class . . . Class BaseN: Body of the class Class Derived(Base1, Base2, Base3, … , BaseN): Body of the class The Derived class inherits from both Base1, Base2 and Base3classes. ... Read More

5K+ Views
As we know both define() and const are used to declare a constant in PHP script.SyntaxLet's discuss the difference between these two.The basic difference between these two is that const defines constants at compile time, whereas define() defines them at run time.We can't use the const keyword to declare constant in conditional blocks, while with define() we can achieve that.const accepts a static scalar(number, string or other constants like true, false, null, __FILE__), whereas define() takes any expression.consts are always case sensitive, whereas define() allows you to define case insensitive constants by passing true as the third argument.const can also ... Read More