Data Types and Built in functions

Data Types and Built in functions

PHP supports 8 data types

  1. scalar data types( A variable in which only one value can be stored at a time
    1. Boolean
    2. integer
    3. Float / Double
    4. String
  2. Compound data type (A variable in which multiple values can be stored)
    1. Array
    2. Object
  3. Special data types
    1. resource
    2. Null

The type of variable is not set by the programmer, rather it is decided at run type byPHP depending upon the context in which the variable is used.

Var_dump (Var_name):-

it is built in function of PHP used to getting the type of variable with content of variable

Gettype(var_name):
It is also an Built in function in PHP it is used to get the type of variable.

Settype(var_name)
It is also an Built in function in PHP it is used to change the type of variable.

I will explain about notice error in the next class

Unset(var_name)
It is also an Built in function in PHP it is used to removing the content from variable.

variables and output statements in PHP

variables and output statements in PHP

We have 2  functions for output in PHP those are echo() and Print ()

actually output statements used to send output to the client (browser)

differences between echo() and print() are

  1. echo() is faster than print() in execution
  2. print() is return an integer value where echo() dosent return a value

in PHP the semicolon (;) is used to separate the two statements or scripts in PHP

Comments in PHP

In PHP, we use // or # to make a one-line comment

/* and */ to make a comment block:

Variables in PHP

  1. variables are used used to store values like text, string, numbers,arrays,objects, etc..
  2. when a variable is set it can be used again and again in PHP program.
  3. all the variables in PHP starts with $.
  4. in PHP an variable dose not need to be declare before it being set.
  5. it is not necessary to tell PHP which data type is the variable.
  6. PHP automatically converts the variable into correct data type depending on the situation where it was being used.

Example:

output will be “abcxyz”

Variable naming rules

  1. A variable name can have alphanumeric characters and underscore “_”.  That is all alphabets and numbers from 0 to 9.
  2. A variable name should start with a letter or “_”. We cant use number at starting of variable name.
  3. No spaces are allowed in variable names.
  4. variable names are case sensitive.
  5. It is advised not use the reserved keywords  of PHP as a variable name.Example : $firstname, $ last_name, $_age
  6. Dot operator (.) is concadination operator in PHP

Note:If we a variable in double quotes (“ ”)self expansion of the variable will happen where the memory usage is more so we should not use variable in double quotes(“ ”)

 

“$firstname”  don’t use these type

8 and 16 bit per channel in photoshop

8 and 16 bit per channel in photoshop

Photoshop knows two data modes:
• 8 bits per channel
• 16 bits per channel

WHY USE 16 BITS PER CHANNEL?

Many digital SLRs allow 12 bits per channel capture and this is later represented as 16 bits per channel in Photoshop (mostly 16 bit TIFF). If the images coming from your camera were perfect, these 4 bits would not make much of a difference as most printers only use a maximum of 8 bits. However, an image that does not require some minor correction is very rare. Once the saturation or contrast of a color image is corrected, the actual color information is soon reduced (due to rounding errors) by one or more bits. If you started with eight bits, you might end up having only six bits of real color information per channel left. The not so smooth color gradients indicate this loss. Starting with 12 bits ensures there is still a sufficient amount of color information available after even major corrections.Note: Stay as much as possible in 16 bits as you can afford (memory, disk space and performance). The test.Here is a test you can perform to experience the 16 bit vs. 8 bit difference. Open a photo in Photoshop, which is in 16 bits. Now perform some curves or levels. When finished changing the levels have a look at the histogram in the “Levels” dialog box. Open a photo in Photoshop but convert it to 8 bit just after you open the file and then do the same curves and levels operations. In the above figure you see is a histogram with many gaps. This indicates lost data and shows up in an inferior gradient smoothness, or posterization. Note: On the other side these gaps should not make you nervous. If the photo and print look fine, that’s all that counts. Conclusion: Remain as long as possible in the 16 bit mode.
Why would you ever use 8 bits per channel if 16 bits is so much better? Using 16 bits:
• Takes longer
• Needs more memory
• Creates larger files
• If you work with versions of Photoshop prior to CS many
operations (e.g. layers) are not available for 16 bits/channel. Before Photoshop CS was released, all our work was done in 8 bit layers and we also got good results. But if you have enough disk space, memory and fast processors, 16 bit is the best way to go.

HTML, CSS, JS, Interview Question and answers

HTML, CSS, JS, Interview Question and answers

  1. What is HTTP ?
    1. HTTP is standards for Hyper Text Transfer Protocol.
  2. What does it mean Small lock on the status bar?
    1. It was a secured connection.
  3. Which is better, gif or jpg format, justify?
    1. Generally JPG is used for High resolution Images, such as artistic images but this takes lot of size in document.  The people who uses slow connections they may face the problems like slow loading but in GIF format it takes low size in 128depth and 256 depth colors and we can also use small animations in GIF format.
  4. Explain HTML Frames (Frames, iFrame, NoFrame, Target controls, Frame Attributes) ?
    1. Frames concept is used to load multiple pages in a single page. We can create frame page by horizontally and vertically if we want to use horizontal frames we use Where Iframe is used.
  5. What is the purpose of an HTML forms?
    1. To get few details from the user.
  6. How Many maximum colors does GIF has ?
    1. 256
  7. Write HTML code to create a INLINE Frame ?
    1. <iframe src=”demo_iframe.htm” width=”200″ height=”200″></iframe>
  8. Why is JavaScript not a programming language but script language? Justify
    1. Write JavaScript code to call multiple function with a single events ?
  9. Write HTML code to control the margins of page?
    1. <body  topmargin=”50”, leftmargin=”50”>
  1.                                                                i.      The above script makes 50px left and top margin
  2. Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata.
  3. The <meta> tag always goes inside the <head> element.
  4. The metadata can be used by browsers (how to display content or reload page), search engines (keywords), or other web services.
  5. The <meta> tag provides metadata about the HTML document. Metadata will not be displayed on the page, but will be machine parsable
  1. Write JavaScript code to call multiple functions with a single event ?
    1. onclick = “f1(); f2”
      or onclick = “funct()”
      function funct() {
      f1()
      f2();

      }
  2. Write JavaScript code to change an image when the users mouse points
    1. document.getElementById(“id”).src = “url Value”;
  3. What is META Tags ?
  1. How can i control the tab order in HTML Form elements?
    1.  <form>
      Field 1 (first tab selection):
      <input type=”text” name=”field1″ tabindex=1 /><br />
      Field 2 (third tab selection):
      <input type=”text” name=”field2″ tabindex=3 /><br />
      Field 3 (second tab selection):
      <input type=”text” name=”field3″ tabindex=2 /><br />
      </form>
  2. How do i get a pop up window to always stay on top using JavaScript ?
    1. <SCRIPT LANGAUGE=”JavaScript”><!–
      function newWindow(file,window) { msgWindow=open(file,window,’resizable=no,width=200,height=400′);
  3. Difference between the DIV and Tables ?
    1. Div generally separates a block of code. It can contain any number of elements, and is controlled by CSS. Think of a table as a block of cells cut into squares. Each cell in the table can be customized and shaped as needed. While both are acceptable for building websites, web developers will tell you that using CSS and divs is the way to go.
  4. Difference between the DIV and SPAN  and  Why Can’t I use only SPAN tag in Document ?
    1. The main difference between the DIV and Span tag is
  5. What is RIA (Rich Internet Application) ?
    1. A rich Internet application (RIA) is a Web application designed to deliver the same features and functions normally associated with deskop applications. RIAs generally split the processing across the Internet/network divide by locating the user interface and related activity and capability on the client side, and the data manipulation and operation on the application side.
  6. What is web 2.0 ?
    1. Web 2.0 is a concept that takes the network as a platform for information sharing, interoperability, user-centered design and collaboration on the World Wide Web. A Web 2.0 site allows users to interact and collaborate with each other in a social media dialogue as creators  of user-generated content in a virtual community, in contrast to websites where users are limited to the passive viewing of content that was created for them.
  7. What is Semantic Web?
    1. The Semantic Web is a collaborative movement lead by the World Wide Web Consortium (W3C). The standard promotes common data formats on the Web. By encouraging the inclusion of semantic content in web pages, the Semantic Web aims at converting the current web dominated by unstructured and semi-structured documents into a “web of data”. The Sematic Web stack builds on the W3C’s Resource Description Framework (RDF).
  8. What are the difference between DIV tag and SECTION element ?
    1. If you need the element simply to add styles to that area of the page, you should use theDIV element.
    2. If that area of the page has a specific meaning, for example it holds all your social media elements or it contains your blogroll, then you should use the SECTION element.
Web Designer interview Questions and Answers

Web Designer interview Questions and Answers

  1. What is the difference between cell spacing and cell padding?
    1. cell padding Specifies the space between the cell wall and the cell content and
      cell spacing Specifies the space between cells
  2. If a page has to be loaded over all frames in window, what should be the value of TARGET attributes?
    1. Target is main window or main frame.
  3. Which one of the following settlement is correct?
    1. A table cannot contain another table and A Form can be nested inside another form
  4. Which element are table cells?
    1. <td> </td>
  5. What tags are used to embed one html page inside another html page (without using frames)?
    1. <div style=”margin: 0 auto; width:100%; height:400px;”><object type=”text/html” data=”http://psd2web.in/” style=”width:100%; height:400px; margin:1%;”></object></div>
  6. In Dreamweaver what is used to apply same layout to my pages?
    1. By using Templates option we can apply same layout for all pages.
  7. Which HTML tag is used to define an internal style sheet?
    1. < style type=text/css media=”screen”>your css here</style>
  8. How to define an inline style in HTML tag ?
    1. <p style=”color: red; text-align:right; font-weight: bold”>
  9. How do you define an inline style?
    1. A CSS or cascading style sheets style that is written directly on the element or tag it affects.
  10. How to align total webpage center?
    1. body{margin: 0 auto;}
  11. What is a DTD? What DTD do you generally use?
    1. A DTD is a Document Type Definition, also know as DOCTYPE. In a document served as text/html, the DOCTYPE informs the browser how to interpret the content of the page. If the the doctype is not declared, the browser assumes you don’t know how to code, and goes into “quirks mode”. If you know what you are doing and include a correct XHTML DOCTYPE, your page will be rendered in “standards mode”.
  12. What are the possible values for the display attribute that are supported by all browsers?
    1. Display : Block;
  13. What is the default value for the display attribute for the image element?
    1. <img src=”smiley.gif” alt=”Smiley face” height=”42″ width=”42″ />
  14. what is the difference between inline and block level elements ?
    1. A block-level element is an element that creates large blocks of content like paragraphs or page divisions. They start new lines of text when you use them, and can contain other blocks as well as inline elements and text or data.An inline element is an element that define text or data in the document like STRONG makes the enclosed text strongly emphasized and Q says the enclosed text is a quotation. They don’t start new lines when you use them, and they generally only contain other inline tags and text or data. Or they include nothing at all, like the BR tag.
  15. What does display: run-in do?
    1. Creates either block or inline boxes, depending on context. Properties apply to run-in boxes based on their final status (inline-level or block-level).
  16. Difference between “visibility:hidden” and “display:none”?
      These two style properties do two different things.

    1. visibility: hidden hides the element, but it still takes up space in the layout and display: none removes the element completely from the document. It does not take up any space, even though the HTML for it is still in the source code.
  17. What are the pros and cons of using display:none?
    1. Pros
      1. Makes fonts look smoother
      2. Rounded edges look round
      3. Type is easier to read (for some) because it looks more like what printed type looks like
      4. Some people feel it’s prettier
    2. Cons
      1. Small fonts become too fuzzy to read
      2. Sharp edges may be fuzzy and not precise
      3. You can’t print anti-aliased text as it comes out blurred
      4. Images are generally larger
      5. Type is easier to read (for some) because the blurring is reduced and the fonts are clear
  18. When to Use Anti-aliasing or Font Smoothing
    1. Anti-aliasing is a good choice for web images with flat colors and curves and text that is intended for web pages. With text, you should try to let the browser display the fonts with CSS, rather than putting them in a graphic.
  19. What are the five possible values for “position”?
    1. Values for position: static, relative, absolute, fixed, inherit
  20. What is the default/initial value for “position”?
    1. Static