php - Array formatting doesn't look correct -


In the code given below, I am dragging a CSS file and trying to return to an array. It's working, but my appearance looks odd What I'm doing

  Array ([body] => array ([width] => 100% [ Background color] = & gt; # e6e6e6))   

My code:

  $ file = file_get_contents ($ _ SERVER ['DOCUMENT_ROOT']. ' ../parse-css-upload/ '. $ This- & new; newFileName); $ Element = explosion ('}', $ file); $ Css_array = array (); // master array to hold all the elements $ element = explosion ('}', $ file); Foreign currency ($ element as element element) {// Get the name of the CSS element $ a_name = explosion ('{', $ element}); $ Name = $ a_name [0]; // Get all keys: value pair style $ a_styles = explosion (';', $ element); // Remove the element name from the first element element $ a_styles [0] = str_replace ($ name '', '', '', $ a_styles [0]); // loop through each style and split the key from $ count = count ($ a_styles); ($ A = 0; $ a & lt; = $ count; $ a ++) {if ($ a_styles [$ a] == ') {$ a_key_value = explosion (': ', $ a_styles [$ a]) ; // Build master CSS array $ css_array [$ name] [$ a_key_value [0]] = $ a_key_value [1]; Array ([body, html] = & gt; array ([width] => 100% [background-color] = & gt; # e6e6e6 [] = & gt;) [body] => Array ([ Font-family] = & gt; "open breath", without-serif [color] = & gt; # 686868 [font-size] = & gt; 16px [font-weight] => 300 [row-height] = & Gt; 1.7 [] = & gt;)    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -