AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 522 of 840

Understanding the CSS3 Filter Functions

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 247 Views

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 More

Set areas within the grid layout in CSS

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 155 Views

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 More

Changing the Default Display Value using CSS

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 322 Views

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 More

Set the kind of decoration used on text in CSS

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 110 Views

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 More

Difference Between For and Foreach in PHP

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 5K+ Views

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 More

Extract numbers after the last hyphen in PHP?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 925 Views

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 More

PHP How to cast variable to array?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 700 Views

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 More

PHP How to display array values with text "even" to be displayed for even index values

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 190 Views

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 More

How to display array values with do while or for statement in my PHP?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 283 Views

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 More

What happens if ++ operator is used with string value in PHP?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 169 Views

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
Showing 5211–5220 of 8,392 articles
« Prev 1 520 521 522 523 524 840 Next »
Advertisements