Trending December 2023 # How Unserialize Function Work In Php With Examples? # Suggested January 2024 # Top 18 Popular

You are reading the article How Unserialize Function Work In Php With Examples? updated in December 2023 on the website Tai-facebook.edu.vn. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested January 2024 How Unserialize Function Work In Php With Examples?

Introduction to PHP unserialize

The PHP unserialize is one of the functions that can be used for to convert the serialized datas into the actual user input datas; it is an opposite process of serialize function mainly it will focus on the arrays, mapping collections it will calculate the array index for each element the big size or some other complex data structures we used some default method for operating the datas also the unserialize () method is returning the Boolean value if the user input is not unserializeable, so the false is returned on the output console the object is created separately for unserialize function.

Start Your Free Software Development Course

Syntax:

PHP has its own syntax for variables, keywords, and functions for creating web-based applications more sophisticated. Generally, PHP serialize format is not well documented like serialize() function; it supports serialized integers, floats, booleans, strings, arrays. Objects and it includes other references for support in the unserialize implementation.

<?php $input= array('',''); $var = serialize($input); $var1 = unserialize($var); ---some php codes based on the user needs---

The above codes are the basic syntax for using the serialize() and unserialize() function in PHP. It supports all the data types and other default functions.

How unserialize Function Work in PHP?

The unserialize function depends on the serialize function; whatever the datas are called and used on that function, it will be fully serialized with keys. If we want to access the data, we want to deserialize the datas or unserialize the datas in the code. Then only we accessed the data; it is also used for the file concepts. Using these serialize and unserialize() functions always return the Boolean conditions it will be to secure and more protected on the unserializing objects, or we can call it as untrusted datas. So it will be avoided for some other malwares, viruses from the outside of the machine. It also secured with the code injections and even db end it will avoid some sql injections attacks for untrusted malware sites.

Generally, the unserialize() function takes two parameters, str and options; the str is one of the parameters it contains serialized strings waiting for to be deserialized, and options are one of the arrays it contains for the control for certain function behaviors it accepts only for valid users particularly inbuilt classes like allowed_classes. It accepts only for the specified class names and particularly some methods like _wakeup() and _destruct(); these methods are implementing by using the serialized objects; when we use this method, it automatically executed when the unserialize() function is called on the specific object.

Examples of PHP unserialize

Given below are the examples of PHP unserialize:

Example #1

Code:

<?php $inputs = serialize(array('Siva', 'Raman', 'Sivaraman', 'wdigb', 'dwiugv', '87dhg', 'wdhgv', 'edhgfv', 'hfe', 'wgieufv', 'ehoije', 'iwuoegf', 'wuieguv','jdgv', 'wqgdjf', 'khwdjgh','jdhfdkswi', 'uqiwuke', 'iqweyf', 'oiuqiwleyugu' )); $vars = unserialize($inputs); var_dump ($vars); echo $vars;

In the above example, we used the serialize and unserialize() functions are in the same codes. Whenever the user gives the input to the application, it will store it on a separate variable, and it is the serialized one and it also to be print on the console by using the echo statements. We want to unserialize the datas by using the unserialize() function, and it will be stored it on a separate variable, and also it will be printed by using the same echo statements. If we want to print the results on the console, we will use other default methods like print, echo etc. these are some methods which is used on the PHP scripts.

Example #2

Code:

<?php class demo { public $vars; } class demo1 { public $vars1; } class demo2 extends demo { public $vars2, $vars3; } class demo3 extends demo2{ public $vars4; } class demo4 extends demo3 { public $vars5; } class demo5 extends demo4 { public $vars6; } class demo6 extends demo5{ public $vars7; } class demo7 extends demo6 { public $vars8,$vars9, $vars10; } $c1 = new demo(); $c3 = new demo2(); $c2 = new demo1(); $d1 = serialize($c1); $d2 = serialize($c2); $d5 = serialize($c3);

Output:

Example #3

Code:

<?php class demo { public $vars; } $vars1= new demo(); $vars2= serialize($vars1); $vars3= unserialize($vars2); echo  var_dump($vars3);

Output:

In the final example, we used both serialize and unserialize functions in that we used key-value pairs for the unserialize the arrays and objects in PHP. We used one variable with the value “Siva” it will be a plain text string and then is converted back to the object that is serialized and unserialized the values.

Conclusion

Recommended Articles

This is a guide to PHP unserialize. Here we discuss the introduction, syntax, and working of unserialize functions in PHP along with different examples, respectively. You may also have a look at the following articles to learn more –

You're reading How Unserialize Function Work In Php With Examples?

How Wordwrap() Function Works In Php

Introduction to PHP wordwrap()

The PHP wordwrap() function of the PHP Programming Language is actually an inbuilt function which helps to wrap a string into many number of characters with the help of a break character inside of the wordwrap() function. It runs only for the PHP 4.0.2 version and also for other above PHP versions in order to support the function. This PHP wordwrap() function helps in wrapping a string into many new lines when it is going to reach to its given length. This function is one the best function when handling the string function in the PHP Programming Language and in some other languages too.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Syntax wordwrap($str1, $width1, $break1, $cut1)

The wordwrap() function of the PHP Programming Language usually accepts four parameters as mentioned above under the syntax section.

$str1: The $str1 Parameter of the wordwrap() function is actually helps in specifying the input string which is actually need to breakup into many lines.

$width1: The $width1 Parameter of the wordwrap() function is actually helps in specifying the number of characters at which point the string has to be/will be wrapped. These are the number of the characters after which the string value will break.

$break1: The $break1 Parameter of the wordwrap() function is actually an optional parameter but if it is specified then it will append the value at the exact point of string break.

$cut1: The $cut1 Parameter of the wordwrap() function is actually a Boolean parameter. If this $cut1 parameter value is set to TRUE value then the string is always going to be wrapped at that point or before the exact specified width. That means it is also going to break a word which are between if it comes in the middle of a constraint that is actually specifying the width1 parameter. And if this cut1 parameter is set to the FALSE value then the wordwrap() function don’t even split the word even if the width parameter has less value than the word’s width.

Return Value:

The wordwrap() function helps in returning a string which is wrapped upto the specified length. It is nothing but a string which is going to be broken into many lines on success or FALSE value on failure.

How wordwrap() Function works in PHP?

The wordwrap() function of the PHP Programming Language mainly based on the four parameters which are mentioned inside of the wordwrap() function. It works by wrapping the given string into number of characters by using the breaking character “break character” but this only works for PHP 4.0.2 and for other above PHP versions. Below are the examples to implement:

Example #1

Code:

<?php $text1 = "My Name is Pavan Kumar Sake."; echo "$newtext1";

Output:

Example #2

Code:

<?php $stringn1 = "Pavan Kumar Sake a Blogger PhysicsNerd and BusinessMan"; $width1 = 10; echo wordwrap($stringn1, $width1, $break1);

Example #3

Code:

<?php $stringn1 = "Congratulations! Pavan Sake kumar"; $width1 = 8; echo wordwrap($stringn1, $width1, $break1);

Output:

Example #4 <?php $stringnn1 = "Congratulations! Power Ranger of the World"; $width11 = 8; $cut11 = true; echo wordwrap($stringnn1, $width11, $break11, $cut11);

Output:

Example #5

This program is so similar to the example 4 but here $cut1 parameter value is passed with the FALSE value and stringnn1 variable is passed new string value, width parameter is mentioned with 7 as value. So the output will be different. For bigger strings or smaller strings, whole strings will be printed after some spaces like that. But most of the time the width of the strings which are wrapped will be of the length “7”.

Code:

<?php $stringnn1 = "Be a part of Game Changer :: profitloops"; $width11 = 7; $cut11 = false; echo wordwrap($stringnn1, $width11, $break11, $cut11);

Output:

Conclusion

I hope you learnt what is the definition of PHP wordwrap() function along with its syntax with all the parameters explanation, How the wordwrap() function works in PHP Programming language along with various examples of implementing the wordwrap() function to understand the wordwrap() function better.

Recommended Articles

This is a guide to PHP wordwrap(). Here we discuss an introduction, syntax, and working of wordwrap() in PHP along with different examples and code implementation. You can also go through our other related articles to learn more –

How Foldleft Function Works In Scala With Examples?

Introduction to Scala foldLeft

Scala foldLeft function can be used with the collection data structure in scala. Also, foldLeft is applicable for both immutable and mutable data structures of collection. This function takes two arguments as parameters. One is the binary operator and the second argument of the collection always points to the current elements of the collection. This binary operator is used to settle the elements of the collection.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Syntax of Scala foldLeft:

This method takes two arguments as a parameter, and it traverses from left to right, so it is named as the foldLeft() method.

def foldLeft[B](z: B)(op: (B, A) ⇒ B): B

Example:

val result = list.foldLeft(1.1)(_ + _)

In this, we give the initial value to the function as 1.1 and try to sum all the elements present in the list. This can be applied to any collection data structure.

How foldLeft Function works in Scala?

foldLeft function traverse the element of collection data structure from left to right to it is named as foldLeft() function in scala. It takes two parameters, and also we can specify the initial value by using this function. This function is a recursive function and helps us from stack-overflow exceptions while programming.

This function is the member function of TraversableOnce in scala. TraversableOnce is a trait built to remove the duplicate code of Traversable and Iterator, which implements the common functions. This trait also contains abstract methods, and the Traversable and Iterator provide this abstract method implementation.

Now we will see one example where we will initialize our list of elements and trying to apply the foldLeft function on it.

Example:

Code:

val myList: Seq[Int] = Seq(10, 30, 50, 60) println(myList)

In this, we are creating one Sequence of integers containing around 4 variables and trying to print out the sequence elements.

Code:

val result = myList.foldLeft(0)(_ + _) println("result is  ::" + result)

After creating the sequence, now we want to sum all the elements present inside the sequence. For this, we are using the foldLeft function. First, we call foldLeft on our collection, followed by the initial value that we have assigned as 0. After that, we use the binary operator + to get the sum of all elements present inside the collection sequence. We can use any binary operator here depend upon the requirement.

We can also use the foldLeft function with string type of collection data structure; we will see one example.

Here we are creating one List if string that contains so many elements into it. After that, we are just printing our newly created list that all.

Example:

Code:

val myList: List[String] = List("amit", "sumit", "vinit", "lalti", "minit") println(myList)

Example:

Now we are trying to add some string after our every element present into the for this, we are using the foldLeft function, and inside this function, we are appending the string that we want to show.

We can also pass a function obtained value directly to the foldLeft function to concatenate the string.

Example:

Code:

val myList: List[String] = List("amit", "sumit", "vinit", "lalti", "minit") println(myList) var result = myList.foldLeft("")(valFun) println(result)

So in the above example, we are passing the value function directly to the foldLeft function. It is just a simple way and more readable to the developer. But i would recommend the first approach to follow.

Examples of Scala foldLeft

Given below are the examples of Scala foldLeft:

Example #1

In this example, we are modifying the string list elements by using the foldLeft function in scala.

Code:

object Main extends App{ val myList: List[String] = List("amit", "sumit", "vinit", "lalti", "minit") println("list before foldLeft function is  :::: ") println(myList) println("list after foldLeft function is  :::: ") println(result) }

Output:

Example #2

In this example, we are finding the sum of all the elements present inside the List collection data structure.

object Main extends App{ val myList: List[Int] = List(100, 200, 300, 400, 500, 600, 700) println("list before foldLeft function is  :::: ") println(myList) var result  = myList.foldLeft(0)(_+_) println("list after foldLeft function is  :::: ") println(result) }

Output:

Example #3

In this example, we are applying different binary operators on the list of integers by using the foldLeft function.

Code:

object Main extends App{ val myList: List[Int] = List(100, 200, 300, 400, 500, 600, 700) println("list before foldLeft function is  :::: ") println(myList) var result  = myList.foldLeft(0)(_-_) println("list after foldLeft function is  :::: ") println(result) var result1  = myList.foldLeft(0)(_*_) println("list after foldLeft function is  :::: ") println(result1) }

Output:

Example #4

In this example, we are finding the maximum value of the collection by using the max function inside the foldLeft function available in scala.

Code:

object Main extends App{ val myList: List[Int] = List(100, 200, 300, 400, 500, 600, 700) println("list before foldLeft function is  :::: ") println(myList) var result  = myList.foldLeft(0)(_ max _) println("list after foldLeft function is  :::: ") println(result) }

Output:

Conclusion

foldLeft functions traverse each element of the collection data structure and help us to perform operations on the element. Thus, it is more reduced and simplified, and untestable to the programmers. Also, it reduces the number of lines of code.

Recommended Articles

This is a guide to Scala foldLeft. Here we discuss the introduction, how the foldLeft function works in scala? And examples respectively. You may also have a look at the following articles to learn more –

How Typedef Work In C++ With Examples

Introduction to C++ typedef

Web development, programming languages, Software testing & others

Syntax:

In C++ each object, variables and keywords have their own syntax and attributes for declaring in the programming codes. Based on the requirement, we will utilize the special keywords or reserved keywords from the programming library.

datatype main() { typedef old datatype name new datatype name; typedef struct structure name; { datatype initialization; } —coding logics— }

The above codes are the basic syntax for using the typedef keywords in the programming logic. We can use the typedef as the structure using struct keyword type; by using this type, we can create n number of data types declaration as well as change the name in a single process.

How does typedef work in C++?

Generally, the typedef is one of the reserved keywords; it provides the same level of abstractions from the actual data type and changes data types that are being used for programmers to allow it with the more focus on the coding concepts. It also makes it easier to write the programming codes and clean them using some destroy() or any other default methods because garbage collectors are the main area for destroying the unwanted codes and clean it for the memory space areas. Depending on the data types, the sizes must be calculated, and it allocates the memory space for the big storage data type variables and small amount storage variables.

Normally the typedef declarations are used with the two different types like typedef type-declaration and typedef type-definition identifier; these two standard typedef declarations are covered with the new name types alias with the some syntax declarations for the language identifiers, and the other type is covered with the some standard libraries and in other POSIX specifications are included with the typedef definitions, and it is more often in the both prefix and suffix, and it includes the common sizes with more number of time calculations included in the codes. Moreover, a typedef keyword often used with the some documentations while indicating the number of the specific variable via included in the programming contexts that may include in the expressions with a variable number of unit measures with counts.

The keyword also used to simplified the variable declarations for the some compound types like struct, union etc. or even though we included some pointers type in the syntax while we used pointer in the typedef keyword, it creates the specific memory storage in the compiler and as well as the address of the variable also changed in the both old and new data types. We can also use structure pointers in the typedef keyword that contains multiple variables with the same type and to declare with the single level statements even though the pointers are included or not in the structure type. The functional pointers also specified with the typedef the preceding number of coding lines will be rewritten with the typedef keyword it reduces the length and complexity of the programs. The functional declarations will be more cryptic, and it clearly shows with the accepts of arguments or the types, it will return the variables.

Examples of C++ typedef

Given below are the examples of C++ typedef:

Example #1

Code:

using namespace std; typedef struct example { int id; char name[14]; int mobile; }s; class demo { int a; public: demo(int a_i = 1) : a{a_i } { cout << “The conversion is called through this method” << endl; } operator string() { cout << “The casting conversion operation is:” << endl; return to_string(a); } }; int main() { s j, k, l; demo b(4) string s = b; b = 32; j.id = 2; strcpy(j.name,”siva”); j.mobile = 82202; k.id = 4; strcpy(j.name,”raman”); j.mobile = 57464; k.id = 6; strcpy(k.name,”sivaraman”); k.mobile = 198591; cout << “Welcome To My Domain” << endl; cout << “ID1 : ” << chúng tôi << endl; cout << “name1 : ” << chúng tôi << endl; cout << “mobile1 : ” << j.mobile << endl; cout << “ID2 : ” << chúng tôi << endl; cout << “name2 : ” << chúng tôi << endl; cout << “mobile2 : ” << k.mobile << endl; cout << “ID3 : ” << chúng tôi << endl; cout << “name3 : ” << chúng tôi << endl; cout << “mobile3 : ” << l.mobile << endl; return 0; }

Example #2

Code:

int main(){ typedef unsigned int a; a p = 3, q = 5; std::cout << “p = ” << p << std::endl; std::cout << “q = ” << q << std::endl; return 1; }

Output:

Example #3

using namespace std; struct example { char *domain; int id; }; typedef int *pr; int main() { struct example eg; eg.domain = “Welcome To My Domain”; eg.id = 7879; cout << “Have a Nice day user for chhosing the domain: ” << eg.domain << ‘n’; cout << “Your User id is: ” << eg.id; pr pvar; return 0; }

Output:

In the above three examples, we used typedef in the different categories using the pointer concepts and the variables that have addressed the old and new ones.

Conclusion

In typedef is the specific reserved keyword area of the C++. It has a lot of pre-defined keywords used to implement the programming logic in the application. Here we used this keyword to mostly reduce the lines of codes and the memory areas also; we can use and edit the codes very clearly, so underlying the codes, it’s the must one for this keyword.

Recommended Articles

This is a guide to C++ typedef. Here we discuss the introduction, how typedef work in C++? Along with examples, respectively. You may also have a look at the following articles to learn more –

How The Undef Function Works In Perl With Examples?

Introduction to Perl undef function

Undef function is used to make the value of the variable undefined in Perl. If we want to make the value of the variable undefined, then we can use the undef function in Perl; this function can be used with a variable, has, list, etc. undef function does not delete the value, but rather it will clear the variable value and make it undefined. So if we want to delete any value, then we have to use the delete function for this; after using undef for any variable, it will make it blank or reset it. In the coming section, we will discuss more this function in detail for better understanding.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

As we discussed already, this function is used to make the value of the list, scalar variable, hash as undefined. It will reset them. Let’s see its syntax for a better understanding of how to use this while programming see below;

1) undef EXPR: in this, we can provide the expression it can anything a variable or list or hash as well.

2) undef: This function can be used without the parentheses as well.

3) undef(): If we want, we can have parentheses as well.

Immediately after the undef keyword, we can write our variable name to make it undefined in Perl. In the coming section, we will see some more sample examples for beginners or better understanding.

How undef function works in Perl?

We know that we undef function is used with a list, hash, or scalar variable to make their value undefined. If you want to make the value undefined or want to reset the value of the variable after some operation, then we can use the undef function in Perl. After making it undefined we can check it for NULL or NIL. Sometimes we may require to reinitialize the variable while programming so we can use the undef function; we can use this function with or without the parentheses in Perl. Immediately after this function, we can provide our variable, which we want to make as undefined. Let’s discuss the method signature with the return type see below;

Method Signature:

1) undef your_variable: This function can be used without parentheses; after this, we can assign the variable name. this will reset the value of the variable and make it undefined.

2) return type: This function returns the undefined as the value.

Let’s see one sample example to see how we can use this function in Perl; below is the sample example for beginners to understand its working in detail see below;

e.g. :

print "Demo for undef in perln"; $myvariable = 50; print "value before is  :: ${myvariable}n"; undef $myvariable; print "value after is  ::  ${myvariable}n";

Points to remember while using the undef function in Perl :

1) This function does not delete the variable from the memory t just makes it blank.

2) If we want to delete the variable, we have to use the delete function in Perl.

3) This function is very easy to use; after the function, we can simply mention the variable name. This is very easy to read and understand.

Examples

Here are the following examples mention below

Example #1

In this example, we are using the undef function to make the value of the variable undefined. We have created several variables to test it. First, it will print the values; after that, it will become vacant all the values from the variable.

print "Demo for undef in perln"; $myvariable1 = 300; $myvariable2 = 500; $myvariable3 = 600; $myvariable4 = 700; $myvariable5 = 800; print "value inside all the variable :::n"; print "value before is  :: ${myvariable1}n"; print "value before is  :: ${myvariable2}n"; print "value before is  :: ${myvariable3}n"; print "value before is  :: ${myvariable4}n"; print "value before is  :: ${myvariable5}n"; undef $myvariable1; undef $myvariable2; undef $myvariable3; undef $myvariable4; undef $myvariable5; print "value after is  ::  ${myvariable1}n"; print "value after is  ::  ${myvariable2}n"; print "value after is  ::  ${myvariable3}n"; print "value after is  ::  ${myvariable4}n"; print "value after is  ::  ${myvariable5}n";

Output:

Example #2

In this example, we are trying to use undef with the string variable in Perl. In this example also we have created so many variables to make it easier to understand better. After that, we are calling the undef function to make the blank.

Code:

print "Demo for undef in perln"; $myvariable1 = "hello"; $myvariable2 = "sampleexmpale"; $myvariable3 = "to show"; $myvariable4 = "undef"; $myvariable5 = "working in perl"; print "value inside all the variable :::n"; print "value before is  :: ${myvariable1}n"; print "value before is  :: ${myvariable2}n"; print "value before is  :: ${myvariable3}n"; print "value before is  :: ${myvariable4}n"; print "value before is  :: ${myvariable5}n"; undef $myvariable1; undef $myvariable2; undef $myvariable3; undef $myvariable4; undef $myvariable5; print "value after is  ::  ${myvariable1}n"; print "value after is  ::  ${myvariable2}n"; print "value after is  ::  ${myvariable3}n"; print "value after is  ::  ${myvariable4}n"; print "value after is  ::  ${myvariable5}n";

Output:

Conclusion

By using the undef function, we can make the value of the variable blank or undefined; it basically stands for undefined. This function does not delete the variable; rather, it makes it blank. This function is very easy to use and understand. We can apply checks on variables after resetting them. Also, it is an in-built function of Perl, and we do not require to include any library from the marketplace.

Recommended Articles

This is a guide to Perl undef. Here we discuss How the undef function works in Perl and Examples along with the codes and outputs. You may also look at the following articles to learn more –

Excel Date Function (Formula, Examples)

The date function in Excel is quite helpful for creating dates that consider Month, Year, and Day. We can feed any number here, and the Date function will create the date with respect to the value we feed in. This function is quite useful and helpful for structuring the date standards when we have multiple dates in multiple formats, and we want to standardize this with a single type for all.

Start Your Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

Let us look at the below simple examples. First, enter the number 43434 in Excel and give the format DD-MM-YYY.

Once the above format is given, look at how Excel shows that number.

Now give the format as [hh]:mm: ss and the display will be as per the below image.

So Excel completely works on numbers and their formats.

We can create an accurate date using the DATE Function in Excel. For example, =DATE (2023, 11, 14) would give the result as 14-11-2023.

The Formula for the DATE Function in Excel is as follows:

The Formula of the DATE function includes 3 arguments, i.e., Year, Month, and Day.

1. Year: It is the mandatory parameter. A year is always a 4-digit number; since it is a number, we need not specify the number in any double quotes.

2. Month: This is also a mandatory parameter. A month should be a 2-digit number that can be supplied either directly to the cell reference or direct supply to the parameter.

3. Day: It is also a mandatory parameter. A day should be a 2-digit number.

How to Use the DATE Function in Excel?

This DATE Function in Excel is very simple and easy to use. Let us now see how to use the DATE Function in Excel with the help of some examples.

You can download this DATE Function Excel Template here – DATE Function Excel Template

Example #1

From the below data, create full date values. In the first column, we have days; in the second column, we have a month; and in the third column, we have a year. We need to combine these three columns and create a full date.

Enter the above into an Excel sheet and apply the below formula to get the full date value.

The Full DATE value is given below:

Example #2

Find the difference between two days in terms of Total Years, Total Months, and Days. For example, assume you are working in an HR department in a company, and you have employee joining date and relieving date data. Next, you need to find the total tenure in the company. For example, 4 Years, 5 Months, and 12 Days.

Here we need to use the DATEDIF function to get the result as per our wish. DATE function alone cannot do the job for us. If we just deduct the relieving date from the joining date, we get the only number of days they worked; we get it in detail.

To get the full result, i.e., Total Tenure, we need to use the DATEDIF function.

DATEDIF function is an undocumented formula where there is no IntelliSense list for it. This can be useful to find the difference between year, month, and day.

The formula looks like a lengthy one. However, I will break it down in detail.

Part 1: =DATEDIF (B2, C2, “Y”) This is the starting date and ending date, and “Y” means we need to know the difference between years.

Part 2: &” Year” is added to a previous part of the foSo, forla. For example, if the first part gives 4, the result will be 4 Years.

Part 3: &DATEDIF(B2, C2, “YM”) Now, we found the difference between years. We find the difference between the months in this part of the formula. “YM” can give the difference between months.

Part 4: &” Months” This is the addition to part 3. If the result of part 3 is 4, then this part will add Months to part 3, i.e., 3 Months

Part 6: &” Days” is added into part 5. If the result from part 5 is 25, it will add Days. I.e., 25 Days.

Example #3

Now I will explain to you the different date formats in Excel. There are many date formats in Excel; each shows the result differently.

VBA Example with Date in Excel:

Assume you are in the welfare team of the company, and you need to send birthday emails to your employees if there are any birthdays. However, sending each one of them is a tedious task. So here, I have developed a code to auto-send birthday wishes.

Below is the list of employees and their birthdays.

I have already written a code to send birthday emails to everyone if there is any birthday today.

Write the above in your VBA module and save the workbook as a macro-enabled workbook.

Once the above code is written on the VBA module, save the workbook.

You only need to add your data to the Excel sheet and run the code every day you visit an office.

Things to Remember

We can supply only numerical values. Anything other than numerical values, we will get an error as #VALUE!

Excel stores dates as serial numbers and displays them according to the format.

Always enter a full-year value. Do not enter shortcut years like 18, 19, 20, etc. Instead, enter the full year 2023, 2023, and 2023

Recommended Articles

This is a guide to Excel DATE Function. Here we discuss the DATE Formula in Excel and how to use the DATE Function in Excel, along with Excel examples and downloadable Excel templates. You may also look at these useful functions in Excel –

Update the detailed information about How Unserialize Function Work In Php With Examples? on the Tai-facebook.edu.vn website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!