Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to get substring of string without using substr() function in php ????

Answers were Sorted based on User's Feedback



how to get substring of string without using substr() function in php ????..

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

how to get substring of string without using substr() function in php ????..

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

how to get substring of string without using substr() function in php ????..

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

Post New Answer

More PHP Interview Questions

Can we extend multiple classes in php?

0 Answers  


What does namespace mean in php?

0 Answers  


What good is polymorphism?

0 Answers  


What is the main difference between require() and require_once()?

0 Answers  


Tell me how to set a page as a home page in a php based site?

0 Answers  


How to upload file in php?

0 Answers  


What are the four scalar types of php?

0 Answers  


Is null function in php?

0 Answers  


Explain scalar type declarations in php7?

0 Answers  


What is indexing how many types?

3 Answers   DLF, Infosys, Net Solution, Vcare,


What is the functionality of the functions strstr() and stristr()?

0 Answers  


How to restrict the number of users login ? For ex:- if the allowed login is 10, for 11th user, the application should restrict them from login.

1 Answers  


Categories