Hello to everybody, I have a problem whith this code:
The original strigs are:
$atributo='STYLE';
$subatributos='font-style: italic; font-weight: bold; text-decoration: underline;';
So I apply this code to the string:
while(substr_count($subatributos,': ') > 0){ // para cada subat dntro d 1 atrib
echo "<BR> nuevo subatributo";
$ini = strpos($subatributos,': '); //delimitamos el subatributo y buscamos los valores
$subatributo = strtoupper(substr($subatributos,0,$ini));
// ya tenemos el subatrib lo eliminamos d la cadena para coger los valores
//echo "subatributo: ".$subatributo;
$subatributos= substr($subatributos,$ini + 1); // eliminamos el atributo
$ini = strpos($subatributos,'; '); //delimitamos el valor
$valor = strtoupper(substr($subatributos,0,$ini));
$subatributos= substr($subatributos,$ini + 1); // eliminamos el valor
echo "<BR> atributo: ".$atributo;
echo "<BR> subatributo: ".$subatributo;
echo "<BR> valor: ".$valor;
echo $attr[$atributo."-".$subatributo] = $valor;
}
echo "<BR> style font-style: ".$attr['STYLE-FONT-STYLE'];
echo "<BR> style font-weight: ".$attr['STYLE-FONT-WEIGHT'];
echo "<BR> style text-decoration: ".$attr['STYLE-TEXT-DECORATION'];
The 'while' is executed three times.
Inside the 'while' I display the vars and everything is ok, but when I exit of the 'while' only the first step has been succesful, I mean $attr['STYLE-FONT-STYLE'] isset but not the other two. ¿WHY?
Thanks for your help in advance.