PHP supports 8 data types
- scalar data types( A variable in which only one value can be stored at a time
- Float / Double
- Compound data type (A variable in which multiple values can be stored)
- Special data types
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.
it is built in function of PHP used to getting the type of variable with content of variable
It is also an Built in function in PHP it is used to get the type of variable.
The output will be :
It is also an Built in function in PHP it is used to change the type of variable.
< ?php $a=10; settype($a,"integer"); echo $a ."--".gettype($a); ?>
The output will be :
I will explain about notice error in the next class
It is also an Built in function in PHP it is used to removing the content from variable.
The output will be :
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
- echo() is faster than print() in execution
- 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
- variables are used used to store values like text, string, numbers,arrays,objects, etc..
- when a variable is set it can be used again and again in PHP program.
- all the variables in PHP starts with $.
- in PHP an variable dose not need to be declare before it being set.
- it is not necessary to tell PHP which data type is the variable.
- PHP automatically converts the variable into correct data type depending on the situation where it was being used.
output will be “abcxyz”
Variable naming rules
- A variable name can have alphanumeric characters and underscore “_”. That is all alphabets and numbers from 0 to 9.
- A variable name should start with a letter or “_”. We cant use number at starting of variable name.
- No spaces are allowed in variable names.
- variable names are case sensitive.
- It is advised not use the reserved keywords of PHP as a variable name.Example : $firstname, $ last_name, $_age
- Dot operator (.) is concadination operator in PHP
$firstname = “PSD”;
$lastname = “WEB”;
$_con = “2”;
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
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.