PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$str = "SLM-03";
$idTemp = str_replace("SLM-","",$str); // Replace the 'SLM-' with '' and got $idTemp = '03'
intval('$idTemp'); // Change the '03' to integer
$salesID = $idTemp + 1; // Adding the '03' with 1
echo "SLM-$salesID"; // it give me SLM-3 not SLM-03
Question is how do i make print out to SLM-03??? bcuz intval() made my 03 to 3, any idea how to do it right???
Thnx...
$str = "SLM-03";
$idTemp = str_replace("SLM-","",$str); // Replace the 'SLM-' with '' and got $idTemp = '03'
intval('$idTemp'); // Change the '03' to integer
$salesID = $idTemp + 1; // Adding the '03' with 1
#start: magic;
str_pad($salesID, 2, '0', STR_PAD_LEFT);
#end: magic;
echo "SLM-$salesID"; // it give me SLM-3 not SLM-03
Let's see if he figures out the comments I made....teehee...