
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
Found 26504 Articles for Server Side Programming

775 Views
Match expression is a new feature that is added in PHP 8. It is very much similar to switch-case statements, but it provides more safe semantics.Match expression does not use the 'case and break' structure of switch-case statements. It supports joint conditions, and it returns a value rather than entering a new code block.We can store match results in a variable because it is an expression.Match expression does not need a break statement like a switch. It supports only single-line expression.Example: PHP 7 Using Switch Statement Live DemoOutputHello World!Example: Above PHP 7 Code Using PHP 8 Match ExpressionOutputLooks Good!Example: Using PHP ... Read More

782 Views
In PHP 8, Constructor Property Promotion is added. It helps to reduce a lot of boilerplate code while constructing simple objects. This feature allows us to combine class fields, constructor definition, and variable assignments, all in one syntax, into the constructor parameter list.We can say that instead of specifying class properties and a constructor, we can combine all of them using constructor property promotion.Example 1: PHP 7 CodeExample 2: PHP 8 codeWe can re-write the above PHP 7 code in PHP 8 as follows −Output10.9 20 30.8In the above code, we combined property definition and population inline in the constructor ... Read More

738 Views
The mixed type in PHP 8 is a new built-in union type. Mixed type is equivalent to array|bool|callable|int|float. Mixing the type is not quite similar to omitting the type completely.That means, the programmer just forgot to write it.Sometimes the programmer prefers to omit some specific type to keep the compatibility with an older version.Mixed type in PHP 8 can take any type of property/return/parameter. We can say that it includes null, callable, resource, all class objects, or all scalar types in PHP. The mixed type is equivalent to the Union type.int|float|bool|string|null|array|object|callable|resourceExample: Mixed Type in PHP 8In PHP 8, Mixed is ... Read More

839 Views
Using Union Type in PHP 8, we can use the values of two or more types, instead of using a single type. To specify multiple types, vertical line (|) is used to join them.Union type supports parameters, return types, and properties.Syntaxtype1|type2|……|type_nExample 1: Union TypeExample 2: PHP 8 Program using Union TypeOutput511.54Nullable Types in Union TypeIn PHP 7.1, nullable type is used with the question mark ?type. In PHP 8, we can declare nullable types as type|null. For example: float|int|null, but we cannot declare it as ?float|int.Nullable Types Syntaxtype1|type2|nullWe should not declare like ?type1|type2 because this would be an ambiguous declaration.Compile-time ... Read More

3K+ Views
Attributes are kinds of classes that can be used to add metadata to other classes, functions, class methods, class properties, constants, and parameters. Attributes do nothing during runtime.Attributes have no impact on the code, but available for the reflection API. Attributes in PHP 8 allow other code to examine the class properties and methods.We can have more than one attribute to a declaration.It may resolve the class name.Attributes can be namespaced.It may have zero or more parametersPHP 8 Attribute SyntaxIn PHP 8, #[ ] (# and square brackets) is used for an attribute declaration.We can declare multiple attributes inside #[ ], ... Read More

660 Views
In PHP 8, we use classes, properties, and class constants, methods, functions, parameters to access the attributes.In PHP 8, Reflection API delivers the getAttribute() method on every matching Reflection object.The getAttribute() method returns an array of ReflectionAttribute illustrations that can be asked for attribute name, arguments and to instantiate an instance of the signified attribute.Example − Reading Attributes with the Reflection API in PHP 8OutputArray ( [Reading] => Array ( ) [Property] => Array ( [type] => function [name] => Student ) )

322 Views
When we compare a numeric in PHP 8, it will use number comparison. Else it will convert the number to a string and will use the string comparison.The string can be categorized in three ways −A string that contains only numeric. Example − 1234 or 1.24e1.A leading–numeric string − A leading string starts with a numeric string but it should be followed with non-numeric characters including the white space. Example − 12xyz or “123”Non-numeric string − The string which cannot be numeric and also a non-leading numeric string.Example − PHP 70=='foo' // PHP 7 will return true.Example − PHP 80 ... Read More

1K+ Views
In order to install tkinter in a local computer, we use several commands on the basis of our OS architecture. There are two ways to import the tkinter library in our Window-based machine which are based on the Python version. Earlier, for lower versions of Python, we generally used to import the tkinter library using the following command −from Tkinter import *However, for Python 3 or later, we generally import the Tkinter library in the environment using the following command −from tkinter import *The only difference between Tkinter and tkinter is that Tkinter was initially used with Python 2 and ... Read More

5K+ Views
Let us suppose we want to create an application where we want to add some description on tkinter widgets such that it displays tooltip text while hovering on the button widget. It can be achieved by adding a tooltip or popup.Tooltips are useful in applications where User Interaction is required. We can define the tooltip by instantiating the constructor of Balloon(win). After that, we can bind the button with the tooltip message that applies on the widget.Example#Import the tkinter library from tkinter import * from tkinter.tix import * #Create an instance of tkinter frame win = Tk() #Set the ... Read More

17K+ Views
Tkinter Canvas are generally used for creating shapes such as arc, rectangle, triangle, freeform shapes, etc. All these shapes can be drawn using the inbuilt function available in tkinter library.ExampleIn this example, we will create a Circle using the create_oval(x0, y0, x1, y1) method by passing the following values of coordinates (x0, y0, x1, y1)#Import the library from tkinter import * #Create an instance of tkinter frame win= Tk() #Define the geometry of window win.geometry("600x400") #Create a canvas object c= Canvas(win, width=400, height=400) c.pack() #Draw an Oval in the canvas c.create_oval(60, 60, 210, 210) win.mainloop()OutputRunning ... Read More