Should or shouldnot use eval() function to evaluates an encrypted PHP source code?
The function is eval ( string $str ) This string $str can be already decrypted from an encrypted string using Hash or bin2hex or base64. The string passed to eval() function must be valid PHP code and must end with semicolon. You can evaluate a class, a function and a string of multiple lines of php code. This function returns NULL unless a return statement is called in the code string. Then the value passed to return is returned. eval() returns FALSE if there is…
How to change the storage engine of a MySQL table
This post will show you how to change a storage engine of a MySQL table to another engine. 1) For SQLYog software users: select a table you want to change the storage engine, then click on Table tab, select Alter Table. Then click on Advanced Properties. You will see a dialog box as seen below, select Table type drop down box, and select an engine you wish for that specific table. 2) For PHPMyAdmin users: select database, select a table that you want to change…
Multilined String in PHP
Multilined string in PHP can be written in many different ways to have your codes look clean and neat. Method 1: You can break the lines into multiple strings on multiple lines using a period in front of the assignment sign in order to concatenate them. Usage: $st = “This is the book”; $st .= ” that I really like to read in my spare time.”; $st .= ” I bring it with me while I’m traveling this summer.”; Method 2: Use excerpt sign and…
Find the location of a file
__FILE__ is a built-in php global variable that you can use to get the location of a file that’s executing. Usage: echo __FILE__; Result (Linux): /var/www/html/my-domain.com/TestDir/setExpiredDate.php (Windows): C:\Documents and Settings\myname\My Documents\www\TestDir\setExpiredDate.php
Using backslash when echo quotation marks
Sometimes you’ll see quotation marks in a string that represent exact language that has come from somebody else. The quotation mark is also used to designate speech acts in fiction and poetry. For example: Mr. Douglas, who was working in his field that morning, said, “The alien spaceship appeared right before my own eyes.” In this case, if you want to echo this string out on a php page, you will have to add a backslash in front of each quotation mark to ensure that…