Turn an array into a pretty print format

@param   array  $arr
@return  string
353624
protected function _deflate($arr)
	{
		$output = 'Array( ' . "\n";
		$a = array();
		foreach ($arr as $key => $val)
		{
			if (is_array($val))
			{
				$a[] = "\t" . '<code class="ky">' . $key . '</code> <code class="op">=></code> <code class="vl">' . $this->_deflate($val) . '</code>';
			}
			else
			{
				$a[] = "\t" . '<code class="ky">' . $key . '</code> <code class="op">=></code> <code class="vl">' . htmlentities($val, ENT_COMPAT, 'UTF-8') . '</code>';
			}
		}
		$output .= implode(", \n", $a) . "\n" . ' )' . "\n";

		return $output;
	}
565118
public static function oxford_join($arr, string $separator = 'and') {
		if (! \is_array($arr) || ! \count($arr)) {
			return '';
		}

		$separator = \trim($separator);
		if (! $separator) {
			$separator = 'and';
		}
		$separator = " $separator ";

		// Let's build a nice array of joinable elements.
		$out = array();
		foreach ($arr as $v) {
			if ($v && (\is_string($v) || \is_numeric($v))) {
				$out[] = (string) $v;
			}
		}

		// Low counts don't require commas.
		if (\count($out) <= 2) {
			return \implode($separator, $out);
		}

		$last = (string) \array_pop($out);
		return \implode(', ', $out) . ",$separator" . $last;
	}
568641
public function urlencode_array(array $ar) {
		$datastring = '';
		foreach ($ar as $key => $val) {
			if (!empty($datastring)) {
				$datastring .= '&';
			}
			$datastring .= urlencode($key).'='.urlencode($val);
		}
		return $datastring;
	}
369242
public static function renderTableRow(array $arrCells) : string
    {
        $strRow = "";
        foreach ($arrCells as $td) {
            $strRow .= self::td($td);
        }
        return self::tr($strRow);
    }
403156
public static function tableformat($array){  
		
		
		
		$t_str = '';
		$content = $array['content'];
		$i = 0;
		
								
		if(is_array($content) && !empty($content)){
			foreach($content as $d){
				$i++;
				if($i == 1){
					$t_str .='<thead><tr>';
					if(is_array($d) && !empty($d)){
						foreach($d as $v){
							$t_str .='<th>'.$v.'</th>';
						}
					}
					$t_str .='</tr></thead>';
				}else{
					if($i == 2)
						$t_str .='<tbody>';
					
					$t_str .='<tr>';
					if(is_array($d) && !empty($d)){
						foreach($d as $v){
							$t_str .='<td>'.$v.'</td>';
						}
					}
					$t_str .='</tr>';
					
				}
				
			}
			$t_str .='</tbody>';
		}
		$str = '
			<style>
			table.list th:first-child{
				width:22%;
				
			}
			</style>
			<table class="list" style="width:100%">
				<thead>
					<tr>
						<th>'.$array['title'].'</th>
					</tr>
				</thead>
				<tbody>
					
					<tr>
						<td>
							'.$array['description'].'
							<br/>
							
							<table class="list" style="width:100%">
								'.$t_str.'
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		<br/>';
		
		return $str;
			
	}
1349093
private function implodeArray(array $arr)
    {
        $values = [];

        foreach ($arr as $value) {
            if (is_array($value)) {
                $values[] = $this->implodeArray($value);
            } else {
                $values[] = $value;
            }
        }

        return "{" . implode(",", $values) . "}";
    }
213062
public function customize(array $arr): array
  {
    $res = [];
    if ( isset($arr[0]) ){
      foreach ( $arr as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          $res[] = $a;
        }
      }
    }
    else if ( isset($arr['items']) ){
      $res = $arr;
      unset($res['items']);
      foreach ( $arr['items'] as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          if ( !isset($res['items']) ){
            $res['items'] = [];
          }
          $res['items'][] = $a;
        }
      }
    }
    return $res;
  }
100704
public static function array_to_object($arr)
    {
        if (gettype($arr) != 'array') {
            return $arr;
        }
        foreach ($arr as $k => $v) {
            if (gettype($v) == 'array' || getType($v) == 'object') {
                $arr[$k] = self::array_to_object($v);
            }
        }
        return (object)$arr;
    }
1140540
private static function format($str, array $values = [])
    {
        foreach ($values as $key => $value) {
            $str = preg_replace('/{\s*'.$key.'\s*\}/', $value, $str);
        }

        return $str;
    }
211987
static function array2str($array)
    {
        $str = '';
        foreach ($array as $li)
        {
            $str .= self::build_line($li) . self::$row_sep;
        }
        return $str;
    }
602366
public function writeArray(array $arr) {

            //Check if this is an associative array or not.
            if ( $this->isPureArray( $arr ) ) {
              // Writing the length for the numeric keys in the array
              $arrLen = count($arr);
              $arrId = ($arrLen << 1) | 0x01;
  
              $this->writeInt($arrId);
              $this->writeString('');
  
              foreach($arr as $v) {
                  $this->writeAMFData($v);
              }

            } else {
                $this->writeInt(1);
                foreach($arr as $key=>$value) {
                    $this->writeString($key);
                    $this->writeAMFData($value);
                }
                $this->writeString('');

            }

        }
486679
private function scoresToFloat(array $arr)
    {
        foreach ($arr as $member => $score) {
            $arr[$member] = (float) $score;
        }

        return $arr;
    }
1056511
private function recordLimit($arr)
    {
        list($this->int_limit, $this->str_end_cursor) = $this->getIntStringFromValue($this->lookupToken($arr['limit']));
        return '';
    }
1161562
function SetStylesArray($arr)
	{
		$style = '';
		foreach (['B', 'I'] as $s) {
			if (isset($arr[$s])) {
				if ($arr[$s]) {
					$this->$s = true;
					$style .= $s;
				} else {
					$this->$s = false;
				}
			} elseif ($this->$s) {
				$style .= $s;
			}
		}
		$this->currentfontstyle = $style;
		$this->SetFont('', $style, 0, false);
	}
1324055
private function getDiscreteText($str) {
        $arr = array();
        for ( $i = 0; $i < strlen($str); $i++ ) {
            if ( $str[$i] == "\n" ) continue;
            if ( ord($str[$i]) < 127 ) {
                array_push($arr, $str[$i]);
                continue;
            }
            if ( ord($str[$i]) > 127 &&
                ord($str[$i+1]) > 127 &&
                ord($str[$i+2]) > 127 ) {
                array_push($arr, substr($str, $i, 3));
                $i += 2;
            }
        }
        return $arr;
    }
218441
private function tokenizeQuoted($arr)
    {
        $str_token = self::TOKEN_PREFIX . ++$this->int_token_count;
        $this->arr_tokens[$str_token] = $arr['quoted'];
        return $str_token;
    }
1001395
public static function toArray(array $arr, $level = 0)
    {
        foreach ($arr as $k => $v) {
            $arr[$k] = (is_array($v) ? self::toArray($v, 1) : '"' . addcslashes($v, '"\\') . '"');
        }

        if ($level === 0) {
            return "'" . pg_escape_string("{" . join(',', $arr) . "}") . "'";
        } else {
            return pg_escape_string("{" . join(',', $arr) . "}");
        }
    }