Find last of match string automatically
Posted
by
jowan
on Pro Webmasters
See other posts from Pro Webmasters
or by jowan
Published on 2011-01-03T03:16:39Z
Indexed on
2011/01/03
4:00 UTC
Read the original article
Hit count: 212
php
I want to make id for entries as long as 7 digits.. while first entry is created, it will get id is 0000001 And my problem is i want to get id and add to 1 every time new entry is created..
I have a bunch of code and still confuse to implement it.
$str_rep = "0000123";
$str_rep2 = "0005123"; // My character string can be like this
$str_rep3 = "0009123"; // My character string can be like this
$match_number= array(1,2,3,4,5,6,7,8,9); // I create array to do it automatically but it was not work.
// I do it manually
$get_str = strstr($str_rep, "1");
$get_str = strstr($str_rep2, "5");
$get_str = strstr($str_rep3, "9");
// Result
echo $get_str . "<br>";
echo $get_str2 . "<br>";
echo $get_str3 . "<br>";
Thanks in advance
© Pro Webmasters or respective owner