Coercion, type coercion or type conversion is the process of altering the data type of a variable into another data type. PHP uses implicit type conversion (aka. Weak/Loose Typing) so it is not necessary to declare the type of a variable. For instance, the following will not produce any errors:
<?php
$foo = "A string";
$foo = 1;
$foo = array();
?>
You can however explicitly cast variables to a certain type:
<?php
$int = (int)4.5/2;
?>
In contrast, strongly typed languages such as C/C++/Java force you to declare the type of value a variable will hold and explicitly state the new type to perform a conversion; not doing so will result in a compiler error.
When should globals be used in PHP?
Problem with using global variables in php is that they lose the the assigned value in a different php file. They only keep the global variable value in the php file in which they are declared.
Instead of globals try and use $_SESSION or $_COOKIE to keep value intact across different php files in a project
Why we use javascript as we have a powerful scripting language php?
First of all, PHP is server side, Javascript is client side. You cannot detect mouse gestures or any clicks with PHP the same way you cannot read a file or modify it or process a form (unless you use AJAX of course). Also, although I love PHP, and it has useful extensions such as the GD library, PHP is not a very good language. Overall we use javascript and PHP because they are used for two completely different things.
1 PHP (Philippine peso) = 1.03305264 INR (Indian rupees)
How do you retrieve results of multiple checkboxes in php?
Well that's fairly easy, as - if you done it correctly - every checkbox has a name, and if this checkbox has been ticked, the POST or GET variable will hold a value named "on", after submitting the form. A standard code to check wether it has been submitted and checked can be something like:
if(isset($_POST['checkbox1']) && !empty($_POST['checkbox1'])){
do something here...
}
that's it.
A framework in PHP is a set of prebuilt classes and functions (like cakePHP.org or codeignitor) that let's you add basic classes and write less do more.
How do you decode to encode using md5 funcation in php?
md5() is one-way encryption method.
Example:
$test_string="php";
$md_encoded_string=md5($test_string);
But, you can't decode the string back to php.So, if you need to check the entered string is php or not
$user_entered_string=md5($_POST['user_input']);
if($md_encoded_string == $user_entered_string)
{
echo "input matched";
}
Which company owns the rights to php?
The company that owns the engine behind PHP is called Zend. Find them at Zend.com
The language itself is controlled by the PHP Language Group. Licensing fun over at the PHP homepage: see related link (below).
What is difference between onblur and onchange function in php?
The Blur event will be fired when an element such as a window' frame' or form elements lose the Focus.
OnChange is when something within a field changes eg, you write something in a text input.
OnBlur When you mouse click or tab away from whatever item (window, textbox, etc...) you are using the OnBlur with. The action assigned to this activity is triggered only when you mouse-click or tab away
OnChange When you make ANY changes within a field, whether you type, delete, paste text.
What do the standard PHP delimiter tags look like?
The two standard PHP delimiter tags look similar to XML/HTML languages.
The beginning tag is: (some configurations also allow )
The ending tag is: ?>
This can be done using AJAX calls, so it wouldn't strictly be with PHP. You would need to add some Javascript that handles the update events if the form fields that you want to watch. That Javascript would send a request back to the server and update accordingly with the result.
From a PHP point of view, I find it easiest to make the Javascript send a paramater in the URL specifying what it wants. You could then handle it with something like this:
if(array_key_exists('action', $_POST){
switch($_POST['action']){
case 'foo': echo 'bar'; break;
case 'hanky': echo 'panky'; break;
default: echo 'boo';
}
exit();
}
// the rest of the document here
If you're just getting started with AJAX queries, you would be best off using a commonly available library for it. I personally recommend jQuery, but there are other ones out there.
if i got your question right, you mean "what are php tags?"
your should write PHP codes between
<?php ... ?>
where ... should be replaced by codes that you need.
But if you mean "what are php codes?": there are some default codes that you may find them on php.net, and the other part is codes (Functions or classes) that other programmers develops..
What is an unidentified index in php?
Probably it's "Undefined Index".
You must have seen it in some of the PHP notices or warnings.
It comes, when you are working with arrays and the Index or Key your code is using doesn't actually exist.
For Example,
if you define an array:
$a = array( 'a'=>'pak' , 'b' => 'asif' );
having two Indexes (a & b),
But later on, you code like:
$a['c'];
Now, c index doesn't actually existed in $a array, so a PHP warning / notice will appear on run time saying:
Undefined Index 'c' ....
Hope this help you!
Assuming you meant windows the OS then you should write it in a text editor such as notepad and save it with the extension .php. You then need to install a web server with PHP installed such as WAMP or XAMPP to run it.
How do you increment a number using while in php?
Example:
<?php
$value = 10;
$i = 0
if(is_int($value))
{
while($i < $value)
{
echo $i;
echo '<br/>';
$i++;
}
}
?>
We can use php tags in different ways.
<?php
//php code to be written here
?>
OR
<?
//php code
?>
This tag will not work when we using editors such as macromedia dreamweaver.
OR
< script language="php">
//php code
</script>
As far as i remember it need additional programs installed on server (not sure), but there was some limitations that forced me develop my own MP3 editor :D
What is the definition of PHP?
PHP is a server side scripting language. It is widely used in web development, to produce dynamic contents.
PHP was an abbreviation of its first version named: Personal Home Pages.
From version 3 of this language its acronym is changed to a recursive acronym i.e.
PHP: Hypertext Preprocessor
If you will read typecasting on php, you will know more on this.
<?php
$str = "10";
$num = (int)$str;
?>
What is the use of a question mark in php?
It is used to tell the sever to use the PHP parser. To begin php you must use <?php, and to end it, it is ?>.
What is the best way to learn php?
Hands on is the best way to learn it. Get yourself a host or install a local Apache server and jump right in!
Check out the related links for Video tutorials for beginning PHP development.
Is PHP a completely object oriented language?
It depends on which language to you , is "Not" completely Object Oriented.
To us PHP is a server scripting language like any other language ASP,CGI,PERL each. Orientation is the views of the users of the engines. It is not the view at the point of source or origin.