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 |
A process can run only in the background. State Whether True or False?
What is the difference between rest and soap?
Where can I learn php?
What is php built on?
When a conditional statement is ended with an endif?
What are the ways to include file in php?
What is the Diff. Between echo() and Print() in PHP?
29 Answers CoreNet, Priya, QueenZend, Sky InfoTech, Syntel,
What is php constructor?
How can we automatically escape incoming data?
hi abinashg i think u have experience in php plz tell me more about php now i raearlly want to do php wat is the future.my email id atul_saini2@yahoo.co.in.plz guide me thanks...........
How can we upload a file in php?
What is a persistence cookie?