Category Archive: PHP
A Simple PHP Home work code that returns the reverse of a given number,
|
<php $num = 1234; $rem =0; $rev =0; $originalnum = $num; while($num > 1) { $rem = $num %10; $rev = ($rev * 10)+ $rem; $num = $num /10; } echo "Original Number: ". $originalnum; echo " Reverse : ". $rev; > |
The Logic here is simple. First get the given number and extract the final digit. Initially the reverse of the number will be zero, on each iteration multiply the reverse with 10 and add the modulus result
The session_id() is one of the in built functions in PHP. Almost in all Framework’s and CMS’s it has been utilized to find the current session. In this tutorial we will see how to utilize this session_id() in small applications apart from Framework and CMS. Generally the session_id() will be used to track existence of
Read More…
Toggling between upper and lower case letter is quite challenging. There is a PHP inbuilt function’s which can do this operation PHP: strtoupper – Manual , PHP strtolower() Function & PHP: ucfirst – Manual , the real challenge would be you have to toggle case of the given word without using PHP built in function
Read More…