Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get last character of string php

substr("testers", -1); // returns "s"
Comment

get last characters of string in php

<?php
	echo substr('Telangana', -3); // ana
	print "<br/>";
	echo substr('Telangana', -1, 1); // a
	print "<br/>";
	echo substr('Telangana', 0, -1); // Telangan
?>
Comment

get last word from string php

function getLastWord($string)
    {
        $string = explode(' ', $string);
        $last_word = array_pop($string);
        return $last_word;
    }
Comment

get last letter in php

substr("testers", -1); // returns "s"
//Or, for multibyte strings :
mb_substr("multibyte string…", -1); // returns "…"
Comment

Get the Last Character of a String in PHP

phpCopy<?php  
$string = 'This is a string';
$lastChar = substr($string, -1);
echo "The last char of the string is $lastChar.";
?>
Comment

Get the Last Character of a String in PHP

phpCopy<?php  
$string = "This is a string";

$lastChar = $string[-1];
echo "The last char of the string is $lastChar.";
?>
Comment

get last word of string php

$split = explode(" ", $string);

echo $split[count($split)-1];
Comment

Get the Last Character of a String in PHP

phpCopy<?php 
$string = "This is a string";
$lastCharPosition = strlen($string) - 1;  
for ($x = $lastCharPosition; $x < strlen($string); $x++) {
    $newString = $string[$x]; 
} 
echo "The last char of the string is $newString.";
?> 
Comment

Get the Last Character of a String in PHP

phpCopy<?php  
$string = "This is a string";
$lengthOfString = strlen($string);
$lastCharPosition = $lengthOfString-1;
$lastChar = $string[$lastCharPosition];
echo "The last char of the string is $lastChar.";
?>
Comment

get last word of string php

$split = explode(" ", $string);

echo $split[count($split)-1];
Comment

Get the Last Character of a String in PHP

phpCopysubstr($stringName, $startingPosition, $lengthOfSubstring);
Comment

PREVIOUS NEXT
Code Example
Php :: get values from text file php 
Php :: 404 page in laravel 
Php :: php json request get value of an array element 
Php :: eloquent whereraw 
Php :: image validate in laravel validater 
Php :: php rsa encryption 
Php :: woo set_stock_quantity 
Php :: wordpress programmatically logout 
Php :: print array items in php 
Php :: item count in cart quantitiy woocommerce 
Php :: csv file to associative array php 
Php :: php pdo check if update query successful 
Php :: join in laravel eloquent 
Php :: how to search by sku woocommerce 
Php :: each in laravel 
Php :: laravel ckeditor 
Php :: php get IP country 
Php :: php get value from url 
Php :: json to array php 
Php :: eloquent with 
Php :: how to make db seeder in laravel 
Php :: format date in php 
Php :: array_fill php 
Php :: set unique value validation for laravel form request 
Php :: check for an existing user laravel eloquent 
Php :: how to get parameter from url in laravel blade 
Php :: laravel check if object is empty 
Php :: php 
Php :: laravel online hash password generator 
Php :: php var in string 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =