Forum Moderators: coopster

Message Too Old, No Replies

how to use the substr to only display first 11 chars?

         

marcus76

7:20 pm on Jan 4, 2006 (gmt 0)

10+ Year Member



Hi,

I have the follwoing line of code:

<td class="dataTableContent" align="right"><?php echo $orders['payment_method'];?></td>

i want to return the first 11 characters only of 'payment_method' - i can't seem to get the syntax correct, can someone please give me some assistance?

Thanks

Marcus

StupidScript

10:37 pm on Jan 4, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$short_payment_method=substr($orders['payment_method'],0,11);

From the PHP Manual [us2.php.net]:

substr ( string string, int start [, int length] )
substr() returns the portion of string specified by the start and length parameters.