- Trending Categories
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
Found 34490 Articles for Programming
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
235 Views
The FILTER_SANITIZE_MAGIC_QUOTES constant performs the addslashes() function to a string. It adds backslashes in front of predefined characters i.e. single quote ('), double quote ("), backslash (\), NULL.ReturnThe FILTER_SANITIZE_MAGIC_QUOTES constant does not return anything.Example Live Demo
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
195 Views
The FILTER_SANITIZE_ENCODED constant encodes special characters.Flags and OptionsFILTER_FLAG_STRIP_LOW − Remove characters with ASCII value less than 32FILTER_FLAG_STRIP_HIGH − Remove characters with ASCII value greater than 127FILTER_FLAG_ENCODE_LOW − Encode characters with ASCII value less than 32FILTER_FLAG_ENCODE_HIGH − Encode characters with ASCII value greater than 127ReturnThe FILTER_SANITIZE_ENCODED constant does not return anything.ExampleThe following is an example that use FILTER_FLAG_ENCODE_HIGH flag to encode characters with ASCII value > 127Example Live DemoOutputThe following is the output.www.example.comLet us see another example.Example Live DemoOutputHere is the output.example.comRead More
![Arushi](https://www.tutorialspoint.com/assets/profiles/13510/profile/60_55588-1512537391.jpg)
188 Views
Stack is a subclass of Vector that implements a standard last-in, first-out stack. Stack only defines the default constructor, which creates an empty stack. Stack includes all the methods defined by Vector, and adds several of its own. Stack( ) Apart from the methods inherited from its parent class Vector, Stack defines the following methods − Sr.No. Method & Description 1 boolean empty() Tests if this stack is empty. Returns true if the stack is empty, and returns false if the stack contains elements. 2 Object peek( ) Returns the element ... Read More
![Rishi Raj](https://www.tutorialspoint.com/assets/profiles/13777/profile/60_73169-1512647303.jpg)
520 Views
As we know that Hash map in Java does not maintain insertion order either by key or by order.Also it does not maintain any other order while adding entries to it. Now in order to sort a hash map according to the values mapped to its corresponding keys we first need to get all values of map considering that hash map has unique values only.Now put all the values in a list and sort this list with the comparator or comparable interface of Java. As we get sorted list of unique values now get corresponding keys from the map and ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
245 Views
The FILTER_VALIDATE_URL constant validates a URL.FlagsFILTER_FLAG_SCHEME_REQUIRED − URL must be RFC compliant.FILTER_FLAG_HOST_REQUIRED − URL must include host name.FILTER_FLAG_PATH_REQUIRED −URL must have a path after the domain name.FILTER_FLAG_QUERY_REQUIRED −URL must have a query string.ReturnThe FILTER_VALIDATE_URL constant does not return anything.Example Live DemoOutputThe following is the output.Valid URL!Let us see another example.Example Live DemoOutputHere is the output.Invalid URL!
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
693 Views
The FILTER_VALIDATE_REGEXP constant validates a value against a Perl-compatible regular expression. Options regexp − The regular expression to validate against. Return The FILTER_VALIDATE_REGEXP constant does not return anything. Example Live Demo The following is the output. Matched String!
![Chandu yadav](https://www.tutorialspoint.com/assets/profiles/22330/profile/60_142811-1519038104.jpg)
450 Views
The FILTER_VALIDATE_IP constant validates an IP address. Flags FILTER_FLAG_IPV4 − The value must be a valid IPv4 address FILTER_FLAG_IPV6 − The value must be a valid IPv6 address FILTER_FLAG_NO_PRIV_RANGE − The value must not be within a private range FILTER_FLAG_NO_RES_RANGE − The value must not be within a reserved range Return The FILTER_VALIDATE_IP constant does not return anything. Example Live Demo The following is the output. Invalid IP address! Let us see another example. Live Demo Here is the output. Valid IP address!
![Fendadis John](https://www.tutorialspoint.com/assets/profiles/13534/profile/60_64028-1512539837.jpg)
603 Views
In order to sort in Java as we know we can use either Comparable or Comparator interfaces in which we could also define our custom logic to sort.One of the approach to sort is to add the entity in TreeSet or TreeMap which would sort the entries as internally they also uses the comparable interface. Now String class in Java internally implements comparable interface so whenever we add string to a tree set or map it uses comparable logic of string class and sort the input entry strings.But String buffer do not have the implementation of comparable interface so ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
740 Views
The FILTER_VALIDATE_INT constant validates value as integer.Options and flagsmin_range − The minimum integer valuemax_range − The maximum integer valueFILTER_FLAG_ALLOW_OCTAL − Allows octal number valuesFILTER_FLAG_ALLOW_HEX − Allows hexadecimal number valuesReturnThe FILTER_VALIDATE_INT constant does not return anything.Example Live DemoOutputThe following is the output.float(3.5) Integer VariableLet us see another example.Example Live DemoOutputHere is the output.Accepted range!