Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by AmitDiwan
Page 522 of 840
Understanding the CSS3 Filter Functions
The filter functions are used to set visual effects on elements like contrast, brightness, hue rotation, opacity, on images, etc. Let us now see some filter functions. Syntax filter: none | blur() | brightness() | contrast() | drop-shadow() | grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia() | url(); As you can see above, with the filter property, we can set the following effects: blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, sepia, and url. Invert The invert() function is used to invert the color samples in an image. ...
Read MoreSet areas within the grid layout in CSS
The CSS grid-template-areas property allows you to define named grid areas within a grid layout, making it easy to position grid items by name rather than line numbers. This property works with grid-area to create intuitive and maintainable grid layouts. Syntax .grid-container { display: grid; grid-template-areas: "area-name area-name . . ." "area-name area-name . . ."; } .grid-item { grid-area: area-name; } Key Properties ...
Read MoreChanging the Default Display Value using CSS
Every element in CSS has a default display value that determines how it appears on the webpage. We can easily change this default behavior by explicitly setting the display property to a different value. Syntax selector { display: value; } Common Display Values ValueDescription blockElement takes full width and starts on new line inlineElement takes only necessary width and flows with text inline-blockCombines properties of both inline and block noneElement is completely hidden Example 1: Changing List Items to Inline Display By default, list items () ...
Read MoreSet the kind of decoration used on text in CSS
The CSS text-decoration-line property is used to set the kind of decoration line that appears on text. This property controls whether text has an underline, overline, strikethrough, or no decoration at all. Syntax text-decoration-line: none|underline|overline|line-through|initial|inherit; Possible Values ValueDescription noneNo line for the text decoration (default) underlineA line gets displayed under the text overlineA line gets displayed over the text line-throughA line gets displayed through the text Example: Overline Decoration The following example shows how to add an overline decoration to text − ...
Read MoreDifference Between For and Foreach in PHP
In this post, we will understand the differences between for and foreach loops in PHP − The 'for' Loop It is an iterative loop that repeats a set of code till a specified condition is reached. It is used to execute a set of code for a specific number of times. Here, the number of times is controlled by the iterator variable. Syntax for( initialization; condition; increment/decrement ) { // code to iterate and execute } Initialization: It is used to initialize the iterator variables. It also helps ...
Read MoreExtract numbers after the last hyphen in PHP?
In PHP, you can extract numbers after the last hyphen in a string using various methods. The most straightforward approach is using the explode() function to split the string and access the last element. Using explode() with Array Index Split the string by hyphens and access the last element using its index ? 7898906756 Using array_pop() Method A more elegant approach using array_pop() to get the last element ? 7898906756 Using end() Function Another method using end() to get the ...
Read MorePHP How to cast variable to array?
To cast a variable to array in PHP, use the array casting syntax. This is useful when you need to ensure a variable is always an array type, regardless of its original data type. Syntax The basic syntax for casting to array is ? $yourNewVariableName = (array)$yourVariableName; Example with Array Variable When casting an existing array, it remains unchanged ? Array ( [0] => Mike [1] => Sam [2] => David ) Example ...
Read MorePHP How to display array values with text "even" to be displayed for even index values
In PHP, you can display array values with the text "even" for even index positions using a for loop with conditional logic. This technique checks if an index is divisible by 2 and assigns "Even" text or the actual value accordingly. Example The following example creates an array and displays "Even" for even index values ? Even 1 Even 3 Even How It Works The code uses the modulo operator (%) to check if an index is even. When $counter % 2 == 0 is true (for indices 0, ...
Read MoreHow to display array values with do while or for statement in my PHP?
In PHP, you can display array values using loop structures like do-while and for statements. These loops provide different approaches to iterate through array elements and display them. Syntax The basic syntax for a do-while loop is − do { // statements } while (condition); The basic syntax for a for loop is − for (initialization; condition; increment) { // statements } Using do-while Loop The do-while loop executes the code block at least once before checking the condition ? ...
Read MoreWhat happens if ++ operator is used with string value in PHP?
When you use the ++ operator with a string value in PHP, it performs an alphanumeric increment operation. For pure alphabetic strings, it increments the last character to the next letter in the alphabet. For numeric strings, it treats the string as a number and increments it mathematically. String Increment Behavior The increment operator follows these rules − For alphabetic characters: increments to next letter (a→b, z→aa) For numeric strings: converts to number and increments For mixed alphanumeric: increments the rightmost character Example The string modified value is=Joho ...
Read More