Home »
OOPS-Interview-Questions
,
Php Interview Questions
,
php-interview-questions-answers
» how eliminate an object?
how eliminate an object?
PMA02:04
Related Posts:
You want to extract part of a string, starting at a particular place in the string Use substr( ) to select your substrings: $substring = substr($string,$start,$length); $username = substr($_REQUEST['username'],0,8); … Read More
Php get_meta_tags-Extracts all meta tag content attributes get_meta_tags — Extracts all meta tag content attributes from a file and returns an array <?php// Assuming the above tags are at www.example.com$tags = get_meta_tags('htt… Read More
how eliminate an object? Objects are automatically destroyed when a script terminates. To force the destruction of an object, use unset( ): $car = new car; // buy new car ... unset($car); // car wreck … Read More
access the values passed to a function?how Use the names from the function prototype: function commercial_sponsorship($letter, $number) { print "This episode of Sesame Street is brought to you by "; print "the letter $letter and number $number.\n"; } com… Read More
Control Structures if else elseif/else if Alternative syntax for control structures while do-while for foreach break continue switch declare return require include require_ once include_ once goto … Read More
What is triggers? A trigger is a database object which is associated with particular database table. Triggers gets called automatically when particular event(INSERT, UPDATE, DELETE) occurs on table. … Read More
How to prevent hijacking in PHP? Make Error_reporting to E_ALL so that all variables will be intialized before using them. Make practice of using htmlentities(), strip_tags(), utf8_decode() and addslashes() for filtering malicious data in php&nb… Read More
How to check whether two floating-point numbers are equal? Use a small delta value, and check if the numbers are equal within that delta: $delta = 0.00001; $a = 1.00000001; $b = 1.00000000; if (abs($a - $b) < $delta) { /* $a and $b are equal */ } … Read More
PHP Redirect - Redirect Script? PHP Redirect Function header('Location: destination.php'); exit(); ou need the Location: part so the browser knows what header it's receiving. Also, don't forget to do an exit() or die() right after… Read More
how create a new instance of an object? Define the class, then use new to create an instance of the class: class user { function load_info($username) { // load profile from database } } $user = new user; $user->load_info($_REQUEST['username'… Read More
What are the differences between mysql_fetch_array(), mysql_fetch_object(), mysql_fetch_row()? mysql_fetch_array() -> Fetch a result row as a combination of associative array and regular array. mysql_fetch_object() -> Fetch a result row as an object. mysql_fetch_row() -> Fetch a result set as a regular array… Read More
exchange the values in two variables without using additional variables for storage? To swap $a and $b: list($a,$b) = array($b,$a); … Read More
magic_quotes_gpc, magic_quotes_runtime Magic quotes is the name of a PHP feature that automatically quotes inputdata, by using the addslashes() function. Historically, this was used so thatform data could be used directly in SQL queries without any security or qu… Read More
$_ENV and $_SERVER ? PHP sets several variables for you containing information about the server, the environment, and your visitor's request. These are stored in the superglobal arrays $_ENV and $_SERVER, but their availability depends on whe… Read More
how associate multiple elements with a single key? Store the multiple elements in an array: $fruits = array('red' => array('strawberry','apple'), 'yellow' => array('banana')); Or, use an object: while ($obj = mysql_fetch_object($r)) { $fruits[ ] =… Read More