Question

Suppose we have a string variable: $str = "How old are you, little monster?" We want...

Suppose we have a string variable: $str = "How old are you, little monster?" We want to extract the string placed between the characters ',' and '?'. Please write a PHP program to achieve this

Homework Answers

Answer #1

input string="How old are you,little monster?"

output string= How old are you,little monster

To extract the given string in PHP, i will use built-in function substr() function,

syntax: substr(stringname,start,length)

following is the Php code:

<?php
// variable declaration!"
$str = "How old are you, little monster?";
echo substr($str, 0, 31);
?>

output

**please give your honest feedback for encouragement**

thank you.....!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
MIPS ASSEMBLY Have the user input a string and then be able to make changes to...
MIPS ASSEMBLY Have the user input a string and then be able to make changes to the characters that are in the string until they are ready to stop. We will need to read in several pieces of data from the user, including a string and multiple characters. You can set a maximum size for the user string, however, the specific size of the string can change and you can’t ask them how long the string is (see the sample...
You have a couple who are 31 years old, and want to retire at the age...
You have a couple who are 31 years old, and want to retire at the age of 67. Knowing that, the couple has a combined annual income of $95,000 today. 1. If the couple want to procrastinate their retirement savings until they reach 35, and if retirement savings will grow at a rate of 8%, how much would they need to save per year, at the end of every year, in order to achieve the $2 million target by the...
You have one Question, Which have four parts, 1st... PHP scriptIn a HTML document, use PHP...
You have one Question, Which have four parts, 1st... PHP scriptIn a HTML document, use PHP to obtain the following :The user will write a sentence as a value of a predefined variable.The output should look like this :The sentence you entered is :This is my sentenceIt is composed of :• 4 different words• 19 characters (including spaces)Note : Your program should make sure the final output is in lower case with the first letter in upper case. 2nd... PHP...
Lets say we have a rock sample that we want to know the age of. Luckily,...
Lets say we have a rock sample that we want to know the age of. Luckily, there are radioactive isotopes and we can count them! Currently, there are 12 stable daughter isotopes and 4 unstable parent isotopes (16 total). The half-life of the unstable isotope is 10 years. How old is the rock? Please explain how you got your answer!
This must be answered not advance methods, focusing on String method. We are working on Ch...
This must be answered not advance methods, focusing on String method. We are working on Ch 9 in Think Java 1st Ed.I need the program to be bare bones and the coding need to be done the long way with no advanced code. in this lab you will have two methods with headings: - public static int countNumberSigns(String tweetText) - public static int countHashtags(String tweetText) 'String tweetText' means the method is expectiong a string value as an input to it....
What does it mean to have a frequency as a variable? Why do we want frequency...
What does it mean to have a frequency as a variable? Why do we want frequency as a variable? How is this accomplished?
Create a function in MIPS using MARS to determine whether a user input string is a...
Create a function in MIPS using MARS to determine whether a user input string is a palindrome or not. Assume that the function is not part of the same program that is calling it. This means it would not have access to your .data segment in the function, so you need to send and receive information from the function itself. The program should be as simple as possible while still using necessary procedures. Follow the instructions below carefully. Instructions: ●...
You are 30 years old today. You want to retire at the age of 60. You...
You are 30 years old today. You want to retire at the age of 60. You expect to live until age 85. You would like to have a monthly income of ​$13,000 per month in retirement. How much do you have to save per month during your working years in order to achieve your retirement​ goal? Assume end of period payments. Assume an annual interest rate of 3.5​% in retirement and 5​% during your working life. How much do you...
5. Suppose that we want to test for the equality of 3 or more population proportions....
5. Suppose that we want to test for the equality of 3 or more population proportions. Which statistical test would you use? Explain the steps involved in applying such a test. please type answer and write at least one page
You want to estimate the average household income for Ohio. You want the margin of error...
You want to estimate the average household income for Ohio. You want the margin of error to be no more than $1,000. Prior data shows the standard deviation of household income is $30,000. How many households should we sample to achieve the desired margin of error? Suppose you want to cut the margin of error down to $500 next time. What should your sample size be? Suppose you want to cut the margin down to 1/3 of what it started...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT