web hosting
build a website

PHP select which part of text/name to output using array

Aug 16, 2015   //   by Anthony Devine   //   Website Development tips  //  No Comments

The below is saying if the $prodName has ~ in it then add in the second part of the name array in instead.

                    $prodName = $_helper->productAttribute($_product, $_product->getName(), 'name');
                    if (strpos($prodName, '~') !== FALSE){
                        $pieces = explode("~", $prodName);
                        $prodName = $pieces[1];