Answers for "get string after a character in php"

PHP
5

get the string after a character in php

$data = "123_String";    
$whatIWant = substr($data, strpos($data, "_") + 1);    
echo $whatIWant;
Posted by: Guest on April-27-2020
1

get words after string in in php

$string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla felis diam, mattis id elementum eget, ullamcorper et purus.";
$prefix = "Nulla";
$index = strpos($string, $prefix) + strlen($prefix);
$result = substr($string, $index);
Posted by: Guest on October-20-2020
0

get substring after character php

<?php
$my_url = 'http://www.example.com/5478631';
echo substr($my_url, strrpos($my_url, '/' )+1)."\n";
?>
  // print: 5478631
Posted by: Guest on January-06-2021

Code answers related to "get string after a character in php"

Browse Popular Code Answers by Language