how to get substring of string without using substr() function in php ????
Answers were Sorted based on User's Feedback
Answer / abhijit sil
Accessing single characters in a string can be achived
using "curly braces"
<?php
$string = 'abcdef';
echo $string{0}; // a
echo $string{3}; // d
echo $string{strlen($string)-1}; // f
?>
Is This Answer Correct ? | 11 Yes | 0 No |
Answer / dheeraj
Use explode()just notice the following code. here it splits
a string to parts and forms an array. Now u assign the array
element to a string.
<?php
$str = "Hello world. It's a beautiful day.";
print_r (explode(" ",$str));
?>
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / nadeem sartawi
Write a PHP function that Returns the part of string
specified by the start and length parameters.
Hint 1: the function accepts three parameters.
Parameter:Description
string :Required. Specifies the string to return a part of
start :Required. Specifies where to start in the string
length :Optional. Specifies the length of the returned
string. :Default is to the end of the string.
Hint 2: YOU ARE NOT ALLOWED TO USE THE "substr" FUNCTION.
Is This Answer Correct ? | 0 Yes | 0 No |
What are Routines?
hello.. i am b.tech 4th year student. i am confused that i should learning php or java. I have some knowledge of java and developed project in java, but i want to develop my career in php. So plz suggest me , i should go with php or java.
what are the rules to be followed at the time of declaring a variable?,what is the purpose of var_dump()function in php,syntax of ternary operator()in php,difference between drop a table and truncate a table...
Will php die?
How to take a substring from a given string?
Whether php supports microsoft sql server?
What is Gd PHP?
Write the code for upload a video file in PHP.How will You Play this in Your Page.?
2 Answers ASD Lab, Convex Digital,
How to create an array of a group of items inside an html form?
What is difference between session and cookies in php?
What does addslashes do in php?
How do I run a php script?