Rasmus Lerdorf released PHP publicly on June 8, 1995 to accelerate bug location and improve the code. This release was named PHP version 2 and already had the basic functionality that PHP has today.
How do you enable PHP sessions?
Find your php.ini file (which holds all the settings for PHP, and how it should work).
Under the "sessions" section, find the directive "session.save_hander." Unless you're directed otherwise, and you want sessions enabled, this directive should be set to the string "files."
If session problems arise, find the directive "session.save_path," and make sure the current path it's set to actually exists (and that PHP can write to it). PHP does not create this directory; you need to.
Still not working? Go to the directory path that session files are saved in (as noted in the "session.save_path" directive) and see if there are session files being created when you start a session in a PHP script. If they are, then your scripts are most likely the problem. If the newly created sessions are empty, make sure that you are actually putting data in them, and that you're not resetting the $_SESSION global variable anywhere.
If they aren't, then it may help to reinstall PHP, or get further assistance elsewhere.
What do you call a CGI expert?
Most CGI scripts are used for websites, thus CGI experts would be named website programmers. If they use CGI scripting for other purposes, however, another title may be more ideal.
What is the difference between echo and print and printf in PHP?
The print function is slightly more dynamic than the echo function by returning a value, and the echo function is slightly (very slightly) faster. The printf function inserts dynamic variables/whatever into wherever you want with special delimiters, such as %s, or %d. For example, printf('There is a difference between %s and %s', 'good', 'evil') would return 'There is a difference between good and evil'.
Here it is:
$array_size = 250;
// If you use v4.2.0 or lower uncomment this
// srand((double)microtime()*1000000);
// Generate $array_size random numbers to be sorted.
for($x = 0; $x < $array_size; $x++)
$ran[$x] = rand(0, 500);
/* The bubble sort method. If you don't know how it works it's very
* simple, values are switched one at a time for each element. */
for($x = 0; $x < $array_size; $x++) {
for($y = 0; $y < $array_size; $y++) {
if($ran[$x] < $ran[$y]) {
$hold = $ran[$x];
$ran[$x] = $ran[$y];
$ran[$y] = $hold;
}
}
}
for($x = 0; $x < $array_size; $x++)
print $ran[$x] . "<br>";
Generate a php script that will display the grade on the basis of marks?
The following PHP function is an example of how you could achieve this: You would then call the function as follows: where *MARK* is the mark I hope this has helped, Cpl.Vadera
How do you create static variables in PHP?
Use the "static" keyword to declare a static variable within a function like shown below.
<?php
function fun() {
static $variable;
static $another_variable = '';
}
?>
How do you clear a variable in PHP?
You can unset a variable in PHP by setting it to NULL. You can set a variable to NULL by declaring it normally, or using the function "unset()". Both methods are acceptable, and accomplish the same thing. Examples of both: ---- $variable = NULL; ---- unset($variable); ----
What types of inheritance exist in PHP?
The possibility of legacy ground-breaking. It permits you to make another class that reuses the properties and strategies from a current class. A class that acquires from another class is called subclass (likewise a kid class or an inferred class). The class from which the subclass acquires is known as parent class (likewise a superclass or a based class). Other than acquiring properties and techniques from the parent class, a subclass class can have extra properties and strategies.
Legacy is exceptionally helpful on the off chance that you need to make a few comparative classes. You put the normal properties and strategies in the parent class and explicit properties and techniques in the youngster classes. This encourages you maintain a strategic distance from copy code that actualizes similar properties and strategy in numerous classes.
PHP legacy model
In the PHP articles and classes instructional exercise, we made a ledger ( BankAccount) class. We can expand the financial balance class by making other ledger classes e.g., sparing record class and financial records class that reuse the properties and strategies for the BankAccount class:
Sparing record : is an ordinary financial balance and acquires month to month intrigue.
Financial records: is an ordinary ledger, acquires no intrigue and has expense deducted month to month.
For more info connect us at Javatpoint
What is exactly stands for php?
In the beginning, it was called PHP/FI for "Personal Home Page / Forms Interpreter". Then when the project got bigger it was renamed into the form "PHP: Hypertext Preprocessor", a recursive acronym.
There are more than 200 common uses of the abbreviation MP. This abbreviation is used to mean military police, media player, Ministerio Publico, Member of Parliament, and melting point.
How does validation work in PHP?
if(isset($_POST['email']))
{
$emal = $_POST['email'];
if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$emal))
{
echo "Valid E-mail";
}
else
{
echo "Invalid Valid E-mail";
}
}
The "require()" and "include()" variables both bring in a called, parsed page into the calling page the functions are in. The only difference between the two is how they handle errors. Advantages would include better organization. Using these functions, it is very easy to organize a website - by being able to edit one page, and dynamicly edit many other pages at the same time. The functions are quick and easy, assuming the server isn't very busy and can handle well-sized loads. Disadvantages would include how these functions are bandwidth eaters - parsing multiple pages hurts bandwidth (but alternatives could be worse); not to mention the server processing speed. Multiple requests for one page can add up. As for the "require_once()" and "include_once()" variables, advantages would include a page only being called once - for sure. Disadvantages include errors on trying to include that same page again.
What is the PHP for armstrong's number code?
<?php
for($i=1; $i<=1000; $i++)
{
$num=$i;
$sum=0;
while($num>=1)
{
$rem=$num%10;
$qub=$rem*$rem*$rem;
$sum=$sum+$qub;
$num=$num/10;
}
if($sum==$i)
{
echo("<br>$sum");
}
}
?>
visit: http://tutorial.planetetutors.com
What is the Use of a dollar sign in php?
the dollar sign appears before a variable/array. Essentially it just tells php that its a variable.
$food = "cheese pizza";
or
$myfavoritenumber = 2 ;
What is the Difference between php hypertext pre-processor and hyper text mark uplanguage?
Well their is a quite big difference between them. a mark-up language um i wouldn't call it a actual programming language, to basic. It deals mostly with the visual aspects interface of a website, where php deals with the side server aspects, which process information which control the processing of information and data accross your a website etc... so i guess the main difference is... mark-up language is used to show the visual interface of a website, php is for functionality. i don't consider mark up languages as a actual true programming language
How to use while loop statement in php?
simple code example: <? while ($a < 10 ) { echo "$a, "; $a++; } echo "Finished"; ?> Will output, 1, 2, 3, 4, 5, 6, 7, 8, 9, Finished this will run through the loop WHILE $a is less than 10, outputting the value of $a to the screen. once $a = 10 then the loop will end and continue on with the rest of the script
How do you change the current directory in PHP?
chdir() PHP function helps in changing the current directory.
What is a regular expression in PHP?
echo or print < both of which write text: <?php echo "TEXT"; print "TEXT"; ?>
What is the difference between echo and print in PHP?
Print always returns a value of true, but echo doesn't.
echo also has a short cut syntax meaning you can immediately follow the php tags by an equals sign and it will echo the result like in the example shown below:
<?=$hello?>
How do you merge and sort an array using PHP?
To merge and sort an array in PHP you need to use the array_merge() and sort() functions like shown in the example below:
<?php
$array1 = array(1, 5, 3, 9, 7);
$array2 = array(8, 2, 6, 4, 0);
// merge the arrays
$merge = array_merge($array1, $array2); // 1, 5, 3, 9, 7, 8, 2, 6, 4, 0
// sort the array
sort($merge); // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
?>