answersLogoWhite

0

$string ="Guess my length"; $length = strlen($string);

now the $length will have the length of the string.

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Math & Arithmetic

How do you count the vowels in a string using PHP?

build an array of vowels then do a foreach on the array and then explode the string on the array value and the answer is -1 of the result


How do you define a constant in PHP?

You can define a constant using the define() directive.you can use this a number of ways;to define a variable to a constant do:$string = "hello";define("string",$string);to define a string to a constant use:define("hello","there");to define a integer or other numerical value use:define("number",1.0);Summery:to define a string use quotes as you would do a string.Unlike variables in PHP a constant cannot be changed or undefined once it is defined. Constant remains automatically globally throughout the script. It means that it can be accessed from inside a function. e.g.


What is 10 percent in Php 250?

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


What are the syntax and semantics of the include construct?

The PHP syntax and semantics are the format (syntax) and the related meanings (semantics) of the text and symbols in the PHP programming language. They form a set of rules that define how a PHP program can be written and interpreted. PHP is a procedural and object-oriented language (OOL) for coding webpage markup text to be transformed into HTML format on computerized devices. In later releases, PHP generates some code to be run by the Zend Engine, beyond using just HTML markup text. The syntax of PHP changed to include OOL keywords in versions PHP 3 and PHP 5.


How do you find version of PHP in uniform server?

The easiest way is to create a file with a name ending in .php (such as info.php), containing only these 3 lines: <? phpinfo(); ?> Upload this file to your web space and access it using your browser. It will show a lot of information about your webserver and the php version running on it.

Related Questions

How do you check the length of a string in PHP?

It is fairly simple to check the length of a string in PHP. All you need to do is use the function strlen(). Below is an example of how it is used. <?php $my_text = "Hello"; echo strlen($my_text); // outputs 5 ?>


How do you find the length of string without using the strlen function in PHP?

$str = "Hello"; $nameArr=str_split($str); print_r($nameArr); echo "length: ".count($nameArr);


How do you count the vowels in a string using PHP?

build an array of vowels then do a foreach on the array and then explode the string on the array value and the answer is -1 of the result


What is str split function in PHP?

According to PHP official manual It is used to converts a string to an array.If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1.If the split_length length exceeds the length of string, the entire string is returned as the first (and only) array element. Syntax: array str_split ( string string [, int split_length] );Example :< ?php$strW3 = "Hello w3answers";$arrW3 = str_split($strW3 );$arrW3 = str_split($strW3 , 3);print_r($arrW3);print_r($arrW3);?>


How do you remove whitespaces from a string in PHP?

&lt;?php trim(ereg_replace( ' +', ' ', $extraWhiteSpace)); ?&gt;


What is var char in php?

Varchar in SQL means string in PHP.


How to use strings with PHP and MySQL?

If you will see this example as below, this may help. &lt;?php $string = mysql_real_escape_string($string); $sql = "insert into stringtable(mystring) values('$string')"; ?&gt;


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"; }


How do you block swear words on webpages?

Using PHP for example and the string replacement attributed to replace the swear words with *** or something.


How do you select a substring from a string using PHP?

In php to select a sub string from a string, use the command: string substr ( string string, int start [, int length]);Simple Examples:


How do you reverse a string in PHP without using a function?

Without any function is impossible. So I'll assume you mean any coded function, in which case the predefined function below is your answer.$string = strrev($string);


What is the text move function in PHP?

"Text move" isn't very clear. If you want to assign strings to different variables, use the assignment operator: &lt;?php $old_var = 'blah'; $new_var = $old_var; echo $new_var; // Displays "blah" ?&gt; If you want to work with a certain part of a string, use substr(): &lt;?php $part_of_string = substr($string, $start, $length); // $start should be an integer, indicating which character to start obtaining the string at // $length should be an integer, indicating how many characters you want to obtain. echo = substr('somesimplestring', 5, 6); // Displays "simple" ?&gt;