Articles → PHP → substr function in PHP

substr function in PHP






Purpose





Syntax


substr(string, start_position, number_of_characters_from_start_position)



Example


<!DOCTYPE html>
<html>
	<body>
		<?php
echo substr("This is the demo of substr function in php",12, 4);
?>
	</body>
</html>



Output


Picture showing the output of substr function in php

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, October 12, 2020

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250