Q:
PHP find output programs (String Functions) | set 1
belongs to collection: PHP Find Output Programs
PHP Find Output Programs
- PHP find output programs (basics) | set 1
- PHP find output programs (basics) | set 2
- PHP find output programs (basics) | set 3
- PHP find output programs (Superglobals) | set 1
- PHP find output programs (conditional statements) | set 1
- PHP find output programs (conditional statements) | set 2
- PHP find output programs (conditional statements) | set 3
- PHP find output programs (switch Statement) | set 1
- PHP find output programs (switch Statement) | set 2
- PHP find output programs (switch Statement) | set 3
- PHP find output programs (Operators) | set 1
- PHP find output programs (Operators) | set 2
- PHP find output programs (Operators) | set 3
- PHP find output programs (Loops) | set 1
- PHP find output programs (Loops) | set 2
- PHP find output programs (Loops) | set 3
- PHP find output programs (Loops) | set 4
- PHP find output programs (Arrays) | set 1
- PHP find output programs (Arrays) | set 2
- PHP find output programs (Arrays) | set 3
- PHP find output programs (User-defined functions) | set 1
- PHP find output programs (User-defined functions) | set 2
- PHP find output programs (User-defined functions) | set 3
- PHP find output programs (String Functions) | set 1
- PHP find output programs (String Functions) | set 2
- PHP find output programs (Number Functions) | set 1
- PHP find output programs (Math Functions) | set 1
- PHP find output programs (Math Functions) | set 2
- PHP find output programs (Date and Time) | set 1
- PHP find output programs (define Constant) | set 1
- PHP find output programs (static variables, classes, methods) | set 1
- PHP find output programs (static variables, classes, methods) | set 2
- PHP find output programs (Regular Expressions) | set 1
- PHP find output programs (Exceptions) | set 1
- PHP find output programs (Exceptions) | set 2
- PHP find output programs (Filters) | set 1
- PHP find output programs (Filters) | set 2
- PHP find output programs (JSON) | set 1
- PHP find output programs (const Keyword) | set 1
- PHP find output programs (Class & Objects) | set 1
- PHP find output programs (Class & Objects) | set 2
- PHP find output programs (Class & Objects) | set 3
- PHP find output programs (Constructors and Destructors) | set 1
- PHP find output programs (Constructors and Destructors) | set 2
- PHP find output programs (Constructors and Destructors) | set 3
- PHP find output programs (Inheritance) | set 1
- PHP find output programs (Inheritance) | set 2
- PHP find output programs (Inheritance) | set 3
Answer 1:
Output:
Explanation:
The above program will print 0 on the console screen. In the above program, we defined two-variable $str1 and $str2. Here, we used strlen() function. But the strlen() function is not used correctly.
The proper syntax for strlen() function is given below:
$len = strlen($str1) + strlen($str2);
The $str1.strlen() and $str2.strlen() will return nothing then the value of $len will be 0, that will be printed on the webpage.
Answer 2:
Output:
Explanation:
In the above program, we created three variables $str1, $str2, and $num that are initialized with "ABC", "1234", and 5678 respectively.
Here, we used strlen(), which is used to calculate the length of specified string as we as number. Let's evaluate the expression.
$len = strlen($str1) + strlen($str2)+ strlen($num); $len = 3 + 4 + 4; $len = 11;
Then the final value of $len will print on the web page.
Answer 3:
Output:
Explanation:
The above program will print 1 on the webpage. In the above program, we created three variables $str1, $str2, and $num that are initialized with "Include", "Help", and "Com" respectively.
$str =$str1.$str2.$str3;
In the above statement we concatenate $str1, $str2, and $str3, then the value of $str will be "IncludeHelpCom".
The "IncludeHelpCom" is a signal word then the str_word_count() will return 1, that will be printed on the webpage.
Answer 4:
Output:
Explanation:
In the above program, we created three variables $str1, $str2, and $num that are initialized with "Include", "-Help", and ".Com" respectively.
In the above statement we concatenate $str1, $str2, and $str3, then the value of $str will be "Include-Help.Com".
The string "Include-Help.Com" contains two words "Include-Help" and ".Com". Because words are also treat separated based on the dot '.', then str_word_count() will return 2, which will be printed on the web page.
Answer5:
Output:
Explanation:
The above program will generate the compile-time error because str_rev() is not a built-in function in PHP. To reverse a string in PHP, we need to use strrev() function instead of str_rev().
need an explanation for this answer? contact us directly to get an explanation for this answer