Guest User

Untitled

a guest
Feb 10th, 2016
114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. //For those who want to change the output format from i.e.{“22″:”244mm”} to 244mm
  4. //The code to show will be
  5.  
  6. $characters = preg_split(‘/”:”/’, $row[‘Custom1’], -1, PREG_SPLIT_NO_EMPTY); // ntx split string into two arrays before and after “:”
  7.  
  8. $dirtybrand = array_slice($characters, 1); // split array into two strings and take the second one
  9.  
  10. $cleanbrand = implode($dirtybrand); // convert array to string
  11.  
  12. $brandprev = preg_split(‘/”/’, $cleanbrand, -1, PREG_SPLIT_NO_EMPTY); // split string $cleanbrand into two arrays , before and after ”
  13.  
  14. $brand = array_slice($brandprev, 0, 1); // split array into two arrays and take only the first one
  15.  
  16. $brandfinal = implode($brand); // convert array into string
  17.  
  18. echo ($brandfinal) ; // show the string
  19.  
  20. ?>
  21.  
  22. This code will replace the original
  23.  
  24. <?php echo $row['Custom1']; ?>
RAW Paste Data