Hello all, I need ur help in the below work. I have the variable in like $scname='CR270SL8 27'' TV"' ; which is fetched from DB. It changed dynamically like CR202SL8 20'' TV etc. I want to display the above variable values like CR270SL8 in first line and 27" TV in second line like CR270SL8 27" TV It is the dynamic variable. Please help me if u know the ans..
If "CR270SL8" is the model/sku and will always be the first item in that field, you can: $scName = 'CR270SL8 27" TV'; $scParts = explode(' ', $scName); $sku = array_shift($scParts); $desc = implode(' ', $scParts); echo "{$sku} <br /> {$desc}"; PHP:
$scname = $row['scname']; $a = explode(' ',$scname); $b = $a[0]; //<---------CR270SL8 $c = $a[1].' '.$a[2]; //<--------27" TV PHP: