answersLogoWhite

0


Best Answer

If you will read typecasting on php, you will know more on this.

<?php

$str = "10";

$num = (int)$str;

?>

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How you can change data type in PHPwrite a script in PHP that change the string data type in numeric data type?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

What sql function returns the numeric position of a named string?

SUBSTR


How can you check if a variable is a string or an integer in PHP?

Integers - The "is_int()" function can be used to check if a variable is has an integer for its value. ---- is_int($variable); // Returns true if $variable is an integer - otherwise false ---- Numeric Strings - Numeric strings are strings with numbers (or things that count as numbers) in them. Numeric-string variables are not integer variables. Numeric-string variables are passed on through forms, instead of integer variables - if you were wondering. Check form values using string formats, and not integer formats. The "is_numeric()" function can be used to check if a variable is a string with numbers - and only numbers - in it (except things that add up to be numbers). ---- is_numeric($variable); // Returns true if $variable is a string, and only contains numbers (broadly speaking) - false otherwise ---- Strings - String values are just text, basically. String variables can contain integers, but that does not make it an integer-type variable - it makes it a numeric string variable. The "is_string" function can be used to check if a variable contains the value of a string. ---- is_string($variable); // Returns true if $variable is a string - false otherwise


What is a string variable?

an alphanumeric or string variable is used to represent any non numeric value. it can be represented by one or more letters or digits but it should start with a letter and end with a dollar sign some examples are a$,r45$ etc....


How to display listbox selected value in a texbox?

Here's the code: &lt;head&gt; &lt;title&gt;List Box Value in Text Box&lt;/title&gt; &lt;script type="text/javascript" language="javascript"&gt; function getValue(string) { document.getElementById("text").value = string; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="form1"&gt; &lt;h2&gt;Get Selected Value&lt;/h2&gt; &lt;select name="select" size="5" onclick="getValue(this.value)"&gt; &lt;option value="apple"&gt;Apple&lt;/option&gt; &lt;option value="tangerines"&gt;Tangerines&lt;/option&gt; &lt;option value="banana"&gt;Banana&lt;/option&gt; &lt;option value="grapes"&gt;Grapes&lt;/option&gt; &lt;/select&gt; &lt;input type="text" id="text" name="text" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;


What is the longest string of prime factors for 30?

the longest string of prime factor for 30 is 2 x 3 x 5

Related questions

Must contain a number?

A numeric string.


How do you change the contents of a cell to currency?

I'll assume your not talking about Excel. In ASP.Net, the string format is {0:c}. This will convert in numeric string value to currency Ex.: 12345.67 will become $12345.67


What is the puporse of using Val function in Visual basic 6.0?

Val() function is used in Visual Basic 6.0 to convert a string to a numeric value (such as integer, double etc.) or to extract a numeric value out of a string, as illustrated below.Val function as used to convert a string to a numeric valuefor example, let str be a string,Dim str as stringDim int as integerstr="09090"int=val(str)gives int = 9090also, used to extract the numeric part out of a following string,ie. a=val("98ASR_tyui") would give a=98however,b=val("The89")would give b=0 as there is no numeric value preceding the string.


What sql function returns the numeric position of a named string?

SUBSTR


What is alphabetic chars only?

In computer programming, a string can be made up of; all numbers (a numeric string,) all letters, (an alphabetic string,) or a mixture of numbers, letters, and symbols, (an alphanumeric string.)


What is a VB script to sort a string in ascending order?

uitihyiuiphoiphuihyi


What is the difference between numeric and string constant?

A numeric constant has a defined numeral value, eg.- 2, 9, 23, 168, etc. A string constant has a defined string value, or a value having english alphabets, eg.- 'A quick brown fox jumps over the lazy dog.'


How can you check if a variable is a string or an integer in PHP?

Integers - The "is_int()" function can be used to check if a variable is has an integer for its value. ---- is_int($variable); // Returns true if $variable is an integer - otherwise false ---- Numeric Strings - Numeric strings are strings with numbers (or things that count as numbers) in them. Numeric-string variables are not integer variables. Numeric-string variables are passed on through forms, instead of integer variables - if you were wondering. Check form values using string formats, and not integer formats. The "is_numeric()" function can be used to check if a variable is a string with numbers - and only numbers - in it (except things that add up to be numbers). ---- is_numeric($variable); // Returns true if $variable is a string, and only contains numbers (broadly speaking) - false otherwise ---- Strings - String values are just text, basically. String variables can contain integers, but that does not make it an integer-type variable - it makes it a numeric string variable. The "is_string" function can be used to check if a variable contains the value of a string. ---- is_string($variable); // Returns true if $variable is a string - false otherwise


What is the difference between numeric and string variables?

Numeric variables store numbers for doing mathematics, counting etc.. String variables store printable sets of characters that can be read by humans in what ever language. int i=3; /* a numeric variable in c */ char *hello = "Hello world, Im 3 years old" /* string that contains a number */ Computer languages generally provide many different ways to transform one into the other.


How can assign a value to a variable in GB Basic?

to simply assign a variable a numeric value a=10 anything=12 etc for string variables a$="sweet" ex$="happy christmas" etc to assign a value by input input"enter numerical value";numeric input"enter string value";string$ i hope that clears it up


How does password appear as a string of dots?

It's a php (web script) string that turns characters into "dots" in most password fields.


What is the only integer that can be assigned to a string?

If you wanted to ask 'Which is the only numeric value that can be assigned to a pointer?', then the answer would be: 0.