Eval Function in PHP

Arjun Thakur
Updated on 27-Jun-2020 08:56:41

1K+ Views

The eval() function evaluates a string as PHP code.Syntaxeval(code)Parameterscode − The PHP code to be evaluated.ReturnThe eval() function returns null unless a return statement is called in the code string. Then the value passed to return is returned. if there is a parse error in the code string, eval() returns false.Example Live DemoOutputThe following is the output.This is $one $two! This is Demo text!

Display Day Name of Week Using Java Calendar

Samual Sam
Updated on 27-Jun-2020 08:55:52

4K+ Views

For using Calendar class, import the following package.import java.util.Calendar;Using the Calendar class, create an object.Calendar calendar = Calendar.getInstance();Now, create a string array of the day names.String[] days = new String[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };Display the day name.days[calendar.get(Calendar.DAY_OF_WEEK) - 1]The following is the final example.Example Live Demoimport java.util.Calendar; public class Demo {    public static void main(String[] args) {       Calendar calendar = Calendar.getInstance();       System.out.println("Day: " + (calendar.get(Calendar.DATE)));       System.out.println("Month: " + (calendar.get(Calendar.MONTH) + 1));       System.out.println("Year: " + (calendar.get(Calendar.YEAR)));       String[] days = new String[] ... Read More

Where Do You See Yourself in Five Years?

Prasanna Kotamraju
Updated on 27-Jun-2020 08:54:12

148 Views

When you are attending an Interview, at some point in time, you can expect this question "Where do you see yourself in five years?”When a hiring manager asks you this, there will be quite a few things running through your head like "Moving up in the career", "That side of the table", "Working for myself", "Heading this Organization" etc., Why do they ask this question?The interviewer might want to understand more about your career goals and check whether you are motivated, proactive and like to stick around and check how this position would fit into your grand plan.How to answer ... Read More

Filter and Sanitize String Constant in PHP

Arjun Thakur
Updated on 27-Jun-2020 08:53:49

406 Views

The FILTER_SANITIZE_STRING constant deletes tags and encodes special characters from a string.FlagsFILTER_FLAG_NO_ENCODE_QUOTES − Do not encode quotesFILTER_FLAG_STRIP_LOW − Removes characters with ASCII value less than 32FILTER_FLAG_STRIP_HIGH − Removes characters with ASCII value greater than 127FILTER_FLAG_ENCODE_LOW − Encodes characters with ASCII value less than 32FILTER_FLAG_ENCODE_HIGH − Encodes characters with ASCII value greater than 127FILTER_FLAG_ENCODE_AMP − Encodes the "&" character to &ReturnThe FILTER_SANITIZE_STRING constant does not return anything.Example Live DemoOutputThe following is the output.Demo!

Display Month of Year Using Java Calendar

karthikeya Boyini
Updated on 27-Jun-2020 08:53:25

4K+ Views

For using Calendar class, import the following package.import java.util.Calendar;Using the Calendar class, create an object.Calendar calendar = Calendar.getInstance();Now, create a string array of the month names.String[] month = new String[] {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };Display the month name.month[calendar.get(Calendar.MONTH)]The following is an example.Example Live Demoimport java.util.Calendar; public class Demo {    public static void main(String[] args) {       Calendar calendar = Calendar.getInstance();       String[] month = new String[] {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };       System.out.println("Current Month = " + month[calendar.get(Calendar.MONTH)]); ... Read More

Filter, Sanitize and Stripped Constants in PHP

Chandu yadav
Updated on 27-Jun-2020 08:53:04

204 Views

The FILTER_SANITIZE_STRIPPED constant encodes or strips unwanted characters.Options and FlagsFILTER_FLAG_NO_ENCODE_QUOTES − This flag does not encode quotesFILTER_FLAG_STRIP_LOW − Strips characters with ASCII value below 32FILTER_FLAG_STRIP_HIGH − Strips characters with ASCII value above 32FILTER_FLAG_ENCODE_LOW − Encodes characters with ASCII value below 32FILTER_FLAG_ENCODE_HIGH − Encodes characters with ASCII value above 32FILTER_FLAG_ENCODE_AMP − Encodes the & character to &ReturnThe FILTER_SANITIZE_STRIPPED constant does not return anything.Example Live DemoOutputThe following is the output.string(10) "Demo!text!"

Filter Sanitize URL Constant in PHP

George John
Updated on 27-Jun-2020 08:52:04

479 Views

The FILTER_SANITIZE_URL constant removes all illegal URL characters from a string. It allows the following −$-_.+!*'(),{}|\^~[]`">

Filter Callback Constant in PHP

Ankith Reddy
Updated on 27-Jun-2020 08:51:17

156 Views

The FILTER_CALLBACK constant calls a user defined function to filter the value.ReturnThe FILTER_CALLBACK constant does not return anything.ExampleThe following is an example that converts the case of a string. Here, existing function in PHP is taken. Live DemoOutputThe following is the output.demo text!

Get Current Time Information in Java

karthikeya Boyini
Updated on 27-Jun-2020 08:50:59

277 Views

Import the following package for to work with Calendar class in Java, import java.util.Calendar;Create a calendar class now.Calendar cal = Calendar.getInstance();To display entire time information, use the following fields.cal.get(Calendar.HOUR_OF_DAY) cal.get(Calendar.HOUR) cal.get(Calendar.MINUTE) cal.get(Calendar.SECOND) cal.get(Calendar.MILLISECOND)The following is the final example.Example Live Demoimport java.util.Calendar; public class Demo {    public static void main(String[] args) {       Calendar cal = Calendar.getInstance();       // current date and time       System.out.println(cal.getTime().toString());       // time information       System.out.println("Hour (24 hour format) : " + cal.get(Calendar.HOUR_OF_DAY));       System.out.println("Hour (12 hour format) : " + cal.get(Calendar.HOUR));     ... Read More

Constant Function in PHP

Arjun Thakur
Updated on 27-Jun-2020 08:50:44

267 Views

The constant() function returns the value of a constant.Syntaxconstant(const)Parametersconst − The name of the constant to checkReturnThe constant() function returns the value of a constant and NULL if the constant is not defined.ExampleThe following is an example that defines a constant. Live DemoOutputThe following is the output.This is it!

Advertisements