answersLogoWhite

0

What is coercion in php?

Updated: 9/20/2023
User Avatar

Wiki User

12y ago

Best Answer

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.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is coercion in php?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Algebra

The PHP syntax is most similar to?

Perl and C


What is the difference between php and mysql?

A simple answer is that PHP is a language while MYSQL is a software.PHPPHP is a interpreted language used mostly for server-side scripting. It uses an interpreter given by PHP.net website used along with apache or anyother server.It is similar to languages as asp , jsp , python scripts as they nearly perform similar function of serverside scripting.MYSQLMYSQL on the other hand is a database server / client (depending upon which one you get)The MYSQL uses SQL (structured Query Language ) Pronounced as Sequel, To store and retrieve data.Most developers in web specially php use mysql on server side, but it is not limited to php it can be used along with almost all the languages to store and retrive data.


What is difference between java Front end developer and Back End developer?

An example of a back-end language is PHP, which is a scripting language. When a PHP page is requested, the server reads any PHP code and renders the markup. The result is HTML that is sent to you. You, the web page viewer, never see one line of PHP code. Assuming that the web server administrator has done his or her job correctly, the server would and could never show you the actual PHP code. It is parsed when the page is served up and the result of that code are turned into HTML.Front End Programming LanguagesJavaScript is probably the most commonly used front-end web development language. It is a scripting language and unless you explicitly have JavaScript disabled in your browser, you see and interact with JavaScript every day. When you request a web page, the JavaScript is either in the page, or is downloaded in a separate file. JavaScript runs in your browser. Most associate JavaScript with the annoying pop-up ads that we all find very annoying. This was true in the past, but today, JavaScript plays an integral part in creating rich user experiences.


Example of number relation problems?

how much of Ph 65lb seed does a dealer need to combine with 200lb of Ph45lb seed to make a Php 55lb blend?


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

Related questions

When was Coercion Records created?

Coercion Records was created in 2003.


Make a sentence with the word Coercion?

They tried coercion, but he still would not do what they wanted.


Which is not a form of government coercion in your society?

Voting is not a form of government coercion in my society.


What is 10 percent in Php 250?

Answer: Php 2510% of Php 250= 10% * Php 250= 0.10 * Php 250= Php 25


Is it illegal to coerce?

Questioner needs to define what they mean by "coercion" -BUT- as a GENERAL rule, yes, coercion is usually considered unlawful conduct.


How can you use the word coercion in a sentence?

He doesn't respond well to coercion, so you won't get him to do something he doesn't want to do. Confessions that result from coercion are normally inadmissible in court.


What is a php consultant?

PHP Consultant is a Expert PHP Developer who Guide PHP Development Process


What is the default extension that most Web servers use to process php scripts?

PHP files extension is .php


What are semantics in PHP?

PHP is related with HTML. HTML can be included into PHP script as well as PHP script can be included into HTML code. PHP begins and ends with &lt;?php ?&gt;. PHP is mix of few languages so semantics is mixed too.


Is php a binary file?

No, PHP is text file with .php extension.


Will php 4.4.7 server support php 5 files?

Yes php 4.4.7 server support php 5 files. But most of the php 5 features are not supported by php 4.4.7 version


What does mean coercion?

The word coercion means getting someone to do something by making threats or otherwise forcing them to do it.