Skip to content

Instantly share code, notes, and snippets.

@ivankristianto
Created July 22, 2017 16:06
Show Gist options
  • Save ivankristianto/5a975398f0d73c896dbd331b82c2e5d1 to your computer and use it in GitHub Desktop.
Save ivankristianto/5a975398f0d73c896dbd331b82c2e5d1 to your computer and use it in GitHub Desktop.
Sample of Spaghetti Code
<?php
function get_something( $username, $password, $date_start, $date_end ) {
header("Content-Type:text/plain");
$dataOutput = array();
// truncated....
$output= trim(preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $output[0]));
$resultnewtotal = array();
if( $newresults[6] && $newresults[8] )
{
for( $i=0; $i<count($newresults[6]); $i++ )
{
if( $newresults[8][$i] == 'XXXX' )
{
// truncated....
if($newinfo[0])
{
// truncated....
}
else
{
// truncated....
if($newinfo2[0])
{
if( is_numeric( trim($newinfo2[4][0]) ) AND strlen( trim($newinfo2[4][0]) ) == 12 )
{
// truncated....
}
else
{
// truncated....
}
// truncated....
}
else
{
// truncated....
if($newinfo3[0])
{
if( is_numeric( trim($newinfo3[3][0]) ) AND strlen( trim($newinfo3[3][0]) ) == 12 )
{
// truncated....
}
else
{
// truncated....
}
// truncated....
}
else
{
// truncated....
if($newinfo4[0])
{
// truncated....
}
else
{
// truncated....
if($newinfo5[0])
{
// truncated....
}
}
}
}
}
}
}
$i++;
}
return $dataOutput;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment