Filter and Sanitize Float Constants in PHP

Ankith Reddy
Updated on 27-Jun-2020 08:48:16

496 Views

The FILTER_SANITIZE_NUMBER_FLOAT constant deletes all illegal characters from a float number.FlagsFILTER_FLAG_ALLOW_FRACTION − Allows fraction separatorFILTER_FLAG_ALLOW_THOUSAND − Allows thousand separatorFILTER_FLAG_ALLOW_SCIENTIFIC − Allows scientific notationReturnThe FILTER_SANITIZE_NUMBER_FLOAT constant does not return anything.ExampleThe following is an example that use FILTER_FLAG_ALLOW_FRACTION flag. Live DemoOutputThe following is the output.string(8) "3-1+2.56"Let us see another example. Here, FILTER_FLAG_ALLOW_THOUSAND flag is used −Example Live DemoOutputHere is the output.string(8) "1-4+25,6"

16 Bit Microprocessors

Chandu yadav
Updated on 27-Jun-2020 08:48:15

5K+ Views

In computer architecture, 16-bit integers, memory addresses, or other data units are those that are 16 bits (2 octets or 2 Bytes) wide. Also, 16-bit CPU and ALU architectures are those that are based on registers, address buses, or data buses of that size. 16-bit microcomputers are computers in which 16-bit microprocessors were the norm.As n-bit register can store 2n different values. So as a result, 16-bit register can store 216 different values. If we consider the signed range of integer values that can be stored in 16 bits is −32, 768 (−1 × 215) through 32, 767 (215 − ... Read More

Get the Day of the Week from Today's Date in Java

Samual Sam
Updated on 27-Jun-2020 08:47:20

483 Views

To get the day of the week, use the Calendar.DAY_OF_WEEK.Firstly, let us get the current date.java.util.Date utilDate = new java.util.Date(); java.sql.Date dt = new java.sql.Date(utilDate.getTime());Now, using GregorianCalendar, set the time.java.util.GregorianCalendar cal = new java.util.GregorianCalendar(); cal.setTime(dt);The last step would display the day of the week as shown in the following example.Example Live Demoimport java.text.ParseException; public class Demo {    public static void main(String[] args) throws ParseException {       java.util.Date utilDate = new java.util.Date();       java.sql.Date dt = new java.sql.Date(utilDate.getTime());       System.out.println("Today's date: "+dt);       java.util.GregorianCalendar cal = new java.util.GregorianCalendar();       cal.setTime(dt);   ... Read More

Is the Saying 'Everything is an Object' in Java True?

siddhartha kotamraju
Updated on 27-Jun-2020 08:46:28

961 Views

Although it is based on C++, Java is more of a “pure” object-oriented language. In Java, everything extends into an Object class. It means the coding is mostly wrapped in Java objects. The Java language assumes that you want to do only object-oriented programming.You cannot code anything in Java without declaring classes and objects.For example, if you have to say a small sentence "Hello World", it should be declared as a class:class HelloWorldApp {    public static void main(String[] args) {       System.out.println("Hello World!"); // Display the string.    } }Because more than 90% of coding involves objects, ... Read More

Filter and Sanitize Number Integer Constant in PHP

George John
Updated on 27-Jun-2020 08:46:14

669 Views

The FILTER_SANITIZE_NUMBER_INT constant deletes all illegal characters from a number.ReturnThe FILTER_SANITIZE_NUMBER_INT constant does not return anything.Example Live DemoOutputThe following is the output.string(5) "4-5+9"

32 Bit Microprocessors

George John
Updated on 27-Jun-2020 08:46:11

5K+ Views

In computer architecture, 32-bit integers, memory addresses, or other data units are those that are 32 bits (4 octets or 4 Bytes) wide. Also, 32-bit CPU and ALU architectures are those that are based on registers, address buses, or data buses of that size. 32-bit microcomputers are computers in which 32-bit microprocessors are the norm. We know that n-bit microprocessor can handle n-bit word size.As n-bit register can store 2n different values so, a 32-bit register can store 232 different values. The range of integer values that can be stored in 32 bits depends on the integer representation used. We ... Read More

Filter and Sanitize Special Characters in PHP

Ankith Reddy
Updated on 27-Jun-2020 08:43:48

784 Views

The FILTER_SANITIZE_SPECIAL_CHARS constant filter HTML-escapes special characters.FlagsFILTER_FLAG_STRIP_LOW − Strip characters with ASCII value below 32FILTER_FLAG_STRIP_HIGH − Strip characters with ASCII value above 32FILTER_FLAG_ENCODE_HIGH − Encode characters with ASCII value above 32ReturnThe FILTER_SANITIZE_SPECIAL_CHARS constant does not anything.Example Live DemoOutputThe following is the output.string(43) "Favorite Sports is Football & Cricket?"

Filter and Sanitize Email Constant in PHP

Arjun Thakur
Updated on 27-Jun-2020 08:40:01

434 Views

The FILTER_SANITIZE_EMAIL constant deletes all illegal characters from an email address.ReturnThe FILTER_SANITIZE_EMAIL constant does not return anything.ExampleOutputThe following is the output.abc@demo.com

Filter, Sanitize and Encode Constants in PHP

Chandu yadav
Updated on 27-Jun-2020 08:38:21

277 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

Filter and Sanitize Magic Quotes Constant in PHP

George John
Updated on 27-Jun-2020 08:34:08

318 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

Advertisements