In .php file i have

$str = "I am in php file";
$str2;

I want to copy specific amount of char in $str2. say suppose i want to copy " I am in" from $str.
How to do?
Is here any help???

function substr

Use substr. For example, $str2 = substr($str, 0, 7) would take the first 7 characters of $str staring from character 0 and put them in $str2.

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.