hi all i've been trying to find a php function for this but couldn't find any
hope anyone here can help

i want to show only a part of string
like SELECT LEFT (0,5)... in SQL
but i want to do it in php
ie:

$string = "hello world";

$result = php_function($string, 0, 5);
echo $result; //hello

i've tried to replace the php_function with str_pad but it's not working
any idea for this problem?

$result = substr($string,0,5);

thanx edwin
while i was searching i'm trying to use str_split and it's working
but i think substr is faster :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.