Search
 
SCRIPT & CODE EXAMPLE
 

PHP

substr() php


<?php
echo substr('abcdef', 1);     // bcdef
echo substr('abcdef', 1, 3);  // bcd
echo substr('abcdef', 0, 4);  // abcd
echo substr('abcdef', 0, 8);  // abcdef
echo substr('abcdef', -1, 1); // f

// Accessing single characters in a string
// can also be achieved using "square brackets"
$string = 'abcdef';
echo $string[0];                 // a
echo $string[3];                 // d
echo $string[strlen($string)-1]; // f

?>

//substr() function returns certain bits of a string 
Comment

php get part of string

substr ( $string , $start , $length  );

/**Returns the extracted part of string;
  *or FALSE on failure, or an empty string
  */
Comment

PREVIOUS NEXT
Code Example
Php :: create array of zeros php 
Php :: add filter in wordpress 
Php :: php preg_replace function 
Php :: blade format date 
Php :: screen size to php 
Php :: manual collection laravel 
Php :: iqbal Laravel save record in two table in one line 
Php :: numbers not displaying in laravel pagination 
Php :: CODEIGNITER codeigniter 4 auth 
Php :: laravel 6 use username instead of id 
Php :: laravel execute command arguments 
Php :: Declare A PHP Array 
Php :: auth user with relation laravel 
Php :: laravel get 
Php :: laraval routing 
Php :: how to know who added product in magento 
Php :: how to truncate all tables laravel 
Php :: cpanel composer update kill 
Php :: php create array 
Php :: php $this 
Php :: self vs this in php 
Php :: laravel.com relationship 
Php :: php read excel file 
Php :: drop column laravel migration 
Php :: laravel set middleware default 
Php :: a non well formed numeric value encountered laravel 
Php :: php array merge without array_merge 
Php :: php laravel rount price to 99 
Php :: laravel collection zip 
Php :: php file handling 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =