Tutorial for Double Quoted String

What is Double Quoted string?

In PHP, we can also define a string by wrapping it in a double quote. However, double quote PHP strings will be used to evaluate escape sequences and variables.

How to Create Strings Using Double Quoted with Example.

When compared to single quotes, double quotes are utilised to build more complicated strings.

Variable names can be enclosed in double quotations, and the values of those variables will be displayed.

Consider the following scenario.

Example 1:-

Output:

Hello text within double quote

Example 2:-

Output:

Parse error: syntax error, unexpected 'quote' (T_STRING) in C:\wamp\www\string1.php on line 2

Example 3:-

Output:

Hello text multiple line text within double quoted string 
Using double "quote" with backslash inside double quoted string 
Using escape sequences in double quoted string

Example 4:-

Output:

Number is: 10

Tagged : / / / / / / /

How to Use CSS Selector in javascript?

querySelector(“CSS Selector”)

The method querySelector() returns the first Element match of the specified selector or group of selectors. If no matches are found, null is returned.

querySelectorAll(“CSS Selector”)

The method querySelectorAll() returns a static (not live) NodeList representing a list of the document’s elements that match the specified group of selectors.

  • The NodeList object represents a collection of nodes. The nodes can be accessed by index numbers. The index starts at 0.
  • You can use the length property of the NodeList object to determine the number of elements that matches the specified selector, then you can loop through all elements and extract the info you want.
  • If the specified selectors include a CSS pseudo-element, the returned list is always empty.

querySelectorAll(“CSS Selector”)

querySelectorAll(“CSS Selector”)

More specific

querySelectorAll(“CSS Selector”)

  • Length Property
  • Loop

innerHTML

The innerHTML property defines the HTML content.

Tagged : / / /

How to use Filter Property in CSS?

This property is used to define visual effects like blur and brightness to an element.

Ex:-

img { filter: blur(10px);}

Syntax-

  • none – Default value. Specifies no effects
  • blur(px) – This is used to apply blur effect to the image. A larger value will create more blur.
  • brightness(%) – This is used to adjust the brightness of the image. 0% will make the image completely black. 100% is default and represents the original image. Values over 100% will provide brighter results.
  • contrast(%) – This is used to adjust the contrast of the image. 0% will make the image completely black. 100% is default and represents the original image. Values over 100% will provide results with less contrast.
  • grayscale(%) – This is used to convert the image to grayscale. 0% is default and represents the original image. 100% will make the image completely gray. Negative values are not allowed.
  • hue-rotate(deg) – This is used to specify a hue rotation on the image. 0deg is default, and represents the original image. Maximum value is 360deg.
  • invert(%) – This is used to invert the samples in the image. 0% is default and represents the original image. 100% will make the image completely inverted. Negative values are not allowed.
  • opacity(%) – This is used to set the opacity level for the image. This is similar to the opacity property. 0% is completely transparent. 100% is default and represents the original image. Negative values are not allowed.
  • saturate(%) – This is used to saturate the image. 0% will make the image completely un-saturated. 100% is default and represents the original image. Values over 100% provides higher-saturated results. Negative values are not allowed.
  • sepia(%) – This is used to convert the image to sepia. 0% is default and represents the original image. 100% will make the image completely sepia. Negative values are not allowed.
  • url() – The url() function takes the location of an XML file that specifies an SVG filter, and may include an anchor to a specific filter element. filter: url(svg-url#element-id)

Tagged : / / / / /

Tutorial for Single Quoted String

What is Single Quoted string?

In PHP, we can make a string by surrounding the content in a single quotation mark. In PHP, it is the simplest way to specify a string.

Escape a literal single quote with a backslash (), and use double backslash to specify a literal backslash (). (\). All other backslash characters, such as r and n, will be output as they are instead of having any special meaning.

How to Create Strings Using Single quotes with Example.

Let’s have a look at the four alternative approaches to writing PHP string functions and manipulating strings in PHP.

Using Single Quotes to Build PHP Strings: The simplest approach to create a string is to use single quotes.

Let’s have a look at a PHP example that generates a simple string.

Example 1:-

Output:

Hello text within single quote

Example 2:-

Output:

Hello text multiple line text within single quoted string 
Using double "quote" directly inside single quoted string 
Using escape sequences \n in single quoted string

Example 3:-

Output:

trying variable $num1 
trying backslash n and backslash t inside single quoted string \n \t 
Using single quote 'my quote' and \backslash

Tagged : / / / / / /

How to use Cursor Property in CSS?

When You create a WebPage using HTML & CSS then you can change the cursor property using CSS as you wish. So, Some below Cursor Property for using-

Cursor

  • default – The default cursor
  • auto – Default. The browser sets a cursor
  • all-scroll – The cursor indicates that something can be scrolled in any direction
  • none – No cursor is rendered for the element
  • not-allowed – The cursor indicates that the requested action will not be executed
  • text – The cursor indicates text that may be selected
  • URL – A comma separated list of URLs to custom cursors. Always specify a generic cursor at the end of the list, in case none of the URL-defined cursors can be used
  • row-resize – The cursor indicates that the row can be resized vertically
  • s-resize – The cursor indicates that an edge of a box is to be moved down (south)
  • se-resize – The cursor indicates that an edge of a box is to be moved down and right (south/east)
  • sw-resize – The cursor indicates that an edge of a box is to be moved down and left (south/west)
  • n-resize – The cursor indicates that an edge of a box is to be moved up (north)
  • ne-resize – The cursor indicates that an edge of a box is to be moved up and right (north/east)
  • nesw-resize – Indicates a bidirectional resize cursor
  • ns-resize – Indicates a bidirectional resize cursor
  • nw-resize – The cursor indicates that an edge of a box is to be moved up and left (north/west)
  • nwse-resize – Indicates a bidirectional resize cursor
  • copy – The cursor indicates something is to be copied
  • alias – The cursor indicates an alias of something is to be created
  • e-resize – The cursor indicates that an edge of a box is to be moved right (east)
  • ew-resize – Indicates a bidirectional resize cursor
  • pointer – The cursor is a pointer and indicates a link
  • progress – The cursor indicates that the program is busy (in progress)
  • zoom-out – The cursor indicates that something can be zoomed out
  • zoom-in – The cursor indicates that something can be zoomed in
  • vertical-text – The cursor indicates vertical-text that may be selected
  • w-resize – The cursor indicates that an edge of a box is to be moved left (west)
  • wait – The cursor indicates that the program is busy
  • context-menu – The cursor indicates that a context-menu is available
  • col-resize – The cursor indicates that the column can be resized horizontally
  • cell – The cursor indicates that a cell (or set of cells) may be selected
  • no-drop – The cursor indicates that the dragged item cannot be dropped here
  • crosshair – The cursor render as a crosshair
  • grab – The cursor indicates that something can be grabbed
  • grabbing – The cursor indicates that something can be grabbed
  • help – The cursor indicates that help is available
  • move – The cursor indicates something is to be moved
Output for above code but when you using cursor then shown result. as below image-
Tagged : / / / /

How to redirect non-www URLs to www?

To redirect your website from non-www to www, add the following lines in your website’s .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

Replace yourdomain.com with your actual domain name.

What is the Purpose of the Node Object Property in JavaScript

Properties of Node Object

The Node object represents a single node in the document tree.

  • nodeName
  • nodeValue
  • nodeType
  • textContent
  • parentNode
  • childNodes
  • firstChild
  • lastChild
  • previousSibling
  • nextSibling

nodeName

The nodeName read-only property returns the name of the current node as a string.

  • CDATASection “#cdata-section”
  • Comment “#comment”
  • Document “#document”
  • DocumentFragment “#document-fragment”
  • DocumentType The value of DocumentType.name
  • Element The value of Element.tagName
  • Entity The entity name
  • EntityReference The name of entity reference
  • Notation The notation name
  • ProcessingInstruction The value of ProcessingInstruction.target
  • Text “#text”

nodeValue

The nodeValue property returns or sets the value of the current node.

  • CDATASection content of the CDATA Section
  • Comment content of the comment
  • Document null
  • DocumentFragment null
  • DocumentType null
  • Element null
  • NamedNodeMap null
  • EntityReference null
  • Notation null
  • ProcessingInstruction entire content excluding the target
  • Text content of the text node

nodeType

The read-only Node.nodeType property represents the type of the node.

ConstantNode TypeDescription
Node.ELEMENT_NODE1An element such as <h1> or <div>
Node.TEXT_NODE3The actual Text of Element or Attribute ex: – “Hello”
Node.PROCESSING_INSTRUCTION_NODE7An instruction to a parser on aspect of the document <?xml version=“1.0”?>
Node.COMMENT_NODE8A comment such as < – – Something – – >
Node.DOCUMENT_NODE9A Document Node
Node.DOCUMENT_TYPE_NODE10A doctype statement <!DOCTYPE html>
Node.DOCUMENT_FRAGMENT_NODE11A document fragment, which represents a lightweight structure to hold a collection of DOM nodes for manipulation or insertion.

Tagged : / / / / /

How to use box-shadow property in CSS?

This property is used to attach one or more shadows to an element.

Syntax: – 

box-shadow: h-shadow v-shadow blur spread color inset

  • h-shadow – The position of the horizontal shadow. Negative values are allowed.
  • v-shadow – The position of the vertical shadow. Negative values are allowed.
  • blur – The blur distance.
  • Spread – Size of shadow. Negative values are allowed
  • color – The color of the shadow
  • none – No shadow. Default
  • inset – Changes the shadow from an outer shadow (outset) to an inner shadow
  • div {box-shadow: 2px 2px 5px red;}
  • div {box-shadow: 2px 2px 5px red, 5px 5px 8px blue;}
Tagged : / / / / / / /

Complete tutorial for String in PHP

What is String?

A PHP string is a collection of characters that can be used to save and manipulate text. PHP only supports a 256-character set, hence it doesn’t support Unicode natively.

The term “string” refers to a group of characters. PHP supports a number of data types, including strings.

Alphanumeric characters are allowed in string variables. When these conditions are met, strings are generated.

  • You create a variable and assign it to string characters.
  • With the echo statement, you can use PHP Strings directly.
  • String functions in PHP are language constructs that aid in the capturing of words.
  • Understanding how PHP strings work and manipulating them can help you become a more successful and productive developer.

In PHP, there are four different ways to specify a string literal.

  1. single quoted
  2. double quoted
  3. heredoc syntax
  4. newdoc syntax (since PHP 5.3)
Tagged : / / / / / /

How to use Border Image Property in CSS?

Its shorthand of all other border-image property.

  • border-image
  • border-image-source
  • border-image-slice
  • border-image-width
  • border-image-outset
  • border-image-repeat

Border Image

Syntax: –

Selector {border-image: border-image-source border-image-slice border-image-width border-image-outset border-image-repeat; }

Ex:-

#borderis {border-image: url(border.png) 10 round;}

border-image-source-

This property is used to specify source of image which is used as border. We can set this property to none or image.

Ex:-

#borderis { border-image-source: none; }

#borderis { border-image-source: url(border.png); }

If the value is “none” or if the specified image can not be found, the border styles will be used.

border-image-slice-

This property is used to specify how to slice the image specified by border-image-source property. The image is always sliced into nine sections: four corners, four edges and the middle. The “middle” part is treated as fully transparent, unless the fill keyword is set. We can set this property to number, % and fill.

Ex:-

#borderis { border-image-slice: 10; }

#borderis { border-image-slice: fill); }

border-image-width-

This property is used to specify width of the border image. We can set this property to number, length and auto.

Ex:-

#borderis { border-image-width: 10; }

#borderis { border-image-width: 10px; }

#borderis { border-image-width: 10%; }

#borderis { border-image-width: auto; }

border-image-outset-

This property is used to specify the amount by which the border image area extends beyond the border box. We can set this property to number and length.

Ex:-

#borderis { border-image-outset: 10; }

#borderis { border-image-outset: 10px; }

Tagged : / / / / / /