|
 |
|
ขอถามเรื่อง Text หน่อยครับ ผมจะทำอย่างให้เพื่อจะลบข้อมูลในตัวแปลตั้งแต่ - เป็นต้นไปออกอ่ะครับ ให้เหลือแต่ |
|
 |
|
|
 |
 |
|
explode
|
 |
 |
 |
 |
Date :
2009-07-13 16:08:05 |
By :
heilender |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองใช้ strchr ดูสิครับ
|
 |
 |
 |
 |
Date :
2009-07-13 16:16:13 |
By :
taobsd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?php
$email = '[email protected]';
$domain = strchr($email, '@');
echo $domain."<br>"; // prints @example.com
$user = strchr($email, '@', true); // As of PHP 5.3.0
echo $user."<br>"; // prints name
?>
|
 |
 |
 |
 |
Date :
2009-07-13 16:17:57 |
By :
taobsd |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
//By P@e
$A = 'LoveLy-005';
$B = explode("-",$A);
echo "เดิมที =".$A."<br>";
echo "ตัดแล้ว =".$B[0];
?>
|
 |
 |
 |
 |
Date :
2009-07-13 16:22:49 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2009-07-13 16:24:19 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
substr ก็ได้ครับ
$str = substr($A,0,6);
|
 |
 |
 |
 |
Date :
2009-07-13 16:33:45 |
By :
ail2geal2 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|