flemingmike Posted October 7, 2010 Share Posted October 7, 2010 hello, is there a wat to limit the following to only the first 25 characters? $customername=$row1["customer"]; thanks Quote Link to comment Share on other sites More sharing options...
liamoco Posted October 7, 2010 Share Posted October 7, 2010 $length = strlen($customername); if ($length > 25) $customername = substr($customername, 0, -25); Quote Link to comment Share on other sites More sharing options...
flemingmike Posted October 7, 2010 Author Share Posted October 7, 2010 thanks Quote Link to comment Share on other sites More sharing options...
liamoco Posted October 7, 2010 Share Posted October 7, 2010 Oops my bad try this... $limit = 25; $length = strlen($customername); if ($length > $limit) { $remove = $limit - $length; $customername = substr($customername, 0, $remove); } Quote Link to comment Share on other sites More sharing options...
flemingmike Posted October 7, 2010 Author Share Posted October 7, 2010 that worked much better! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.