php new tutorial: contents: 1. single quotes and concatenation 2. escape sequences 3. math functions
Lets start this tutorial. 1. Use of single quote and concatenation work of single and double quotes is almost similar the difference is in the execution time. let see an example: <?php echo "hello";// takes more time to execute echo 'world';// comparatively takes lesser time to execute ?>
now lets see what concatenation is: In computer programming, string concatenation is the operation of joining two character strings end-to-end. For example, the strings "snow" and "ball" may be concatenated to give "snowball". In many programming languages, string concatenation is a binary infix operator. For example, the following expression uses the "+" symbol as the concatenation operator to join two strings: "Hello, " + "World";, and has the value "Hello, World".
lets have a look on an example of php: <?php $var = 'Annas'; echo 'hello '.$var.'<br>'; ?> output: hello Annas
Now the second part: what are Escape sequences? An escape sequence is a series of characters used to change the state of computers and their attached peripheral devices. These are also known as control sequences, reflecting their use in device control. Some control sequences are special characters that always have the same meaning. Escape sequences use an escape character to change the meaning of the characters which follow it, meaning that the characters can be interpreted as a command to be executed rather than as data. some examples of escape sequences: \a alarm, that is, the BEL character (hex 07) \cx "control-x", where x is any character \e escape (hex 1B) \f formfeed (hex 0C) \n newline (hex 0A)
Third topic for this tutorial i.e simple math functions: like other languages we can also add , subtract , multiply and divide in php. example: <?php $num1 = 10; $num2 = 5; echo $num1 + $num2= '<br>'; echo $num1 - $num2= '<br>'; echo $num1 * $num2= '<br>'; echo $num1 / $num2= '<br>'; $num1++; //increment the value by one $num2--;//decrements the value by one ?>
increment and decrement functions are mostly used in loops but that's another topic. that's it for this tutorial. do comment your questions and views about this tutorial. goodluck :)
my mom used to program in binary....back in the day. She had a tablet too! Only it was stone.
binary coding is way to difficult atleast for me
@Agent_Sniffles: I have also programmed in machine language....:D
@adhokshaj you mean steampunk style programming :P
this is very helpful btw
dear users please stick to the topic ie php thank you !
i m thankful to you that you liked my tutorial stay tuned for other tutorials
Haa the 'my mom...binary coding...blaah' she wrote it. Not me. Lmao But, I have NO clue what it is...so yeah. Just putting that out there. :P
stick to the topic i.e its a request thank you
@annas you are doing great ! But this is just not the right place. Why not open yourself a blog and do the same !
Join our real-time social learning platform and learn together with your friends!