PHP?
PMA04:16
Related Posts:
What is MVC? MVC- Model, View, Controller - is simply Model - contains data access code and all of you business logic code. View - Contains markup/design code, generally html,xml, json. Controller - contains very little… Read More
want to link two objects, so when you update one, you also update the other? Use =& to assign one object to another by reference: $adam = new user; $dave =& $adam; … Read More
how execute different code depending on the number and type of arguments passed to a method? PHP doesn't support method polymorphism as a built-in feature. However, you can emulate it using various type-checking functions. The following combine( ) function uses is_numeric(), is_string(), is_array(), and is_bool(… 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
Scope Resolution Operator? :: is the scope operator it is used to call methods of a class that has not been instantiated. … 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
what is ob_start? ob_start turns on output buffering, … 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
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
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
What is SQL Injection? SQL Injection is the hacking technique which attempts to pass SQL commands (statements) through a web application for execution by the backend database. it can be prevented by mysql_real_escape_string() function of PHP. … 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
how access a method in the parent class that's been overridden in the child? Prefix parent:: to the method name: class shape { function draw( ) { // write to screen } } class circle extends shape { function draw($origin, $radius) { // validate data if ($radius > … 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
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