Agnostic Bear
08-02-2011, 12:52 PM
Hey guys I'm just starting to get into the professional Java scene and I wrote this quick java script for you to all use when you need to do addition :)!
$numberOne = 1;
$numberTwo = 2;
class Addition
{
function __construct()
{
$true = true;
$false = false;
// make REALLy sure our variables are correct!!!!!
for( $i = 0; $i < 200; $i++ ) {
if( $true !== true ) {
exit( 'OH NO' );
}
if( $false !== false ) {
exit( 'OH NO' );
}
}
}
function addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayF irst( $numberOne, $numberTwo )
{
$numberOneCheck = new ArrayBuilder();
$numberTwoCheck = new ArrayBuilder();
if( $numberOneCheck->hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArr ayWeWouldntWantAnyAccidentsNowWouldWe( $numberOne ) === 'NO IT IS NOT AN INTEGER' )
{ exit( 'AAAAAAAARGH IT IS NOT A NUMBER' ); }
if( $numberTwoCheck->hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArr ayWeWouldntWantAnyAccidentsNowWouldWe( $numberTwo ) === 'NO IT IS NOT AN INTEGER' )
{ exit( 'AAAAAAAARGH IT IS NOT A NUMBER' ); }
$numberOne = (int)$numberOne;
$numberTwo = (int)$numberTwo;
$newResult = $numberOne + $numberTwo;
$newResult = (int)$newResult;
if( ((int)$newResult - ((int)$numberOne + (int)$numberTwo)) === (int)0 ) {
return (string)$newResult;
}
}
}
class ArrayBuilder
{
function __construct()
{
$true = true;
$false = false;
// make REALLy sure our variables are correct!!!!!
for( $i = 0; $i < 200; $i++ ) {
if( $true !== true ) {
exit( 'OH NO' );
}
if( $false !== false ) {
exit( 'OH NO' );
}
}
}
function parseArray( $incoming )
{
if( $this->makeReallySureTheThingComingInIsActuallyAnArray( $incoming ) !== true ) {
exit( 'OH NO IT\'S NOT REALLY AN ARRAY :(' );
}
// ok let's just make sure it isn't really trying to hdie
if( $this->makeReallySureTheThingComingInIsActuallyAnArray( $incoming ) !== true ) {
exit( 'haha you thought you could catch me out you cannot i have found out you are not an array mr. not array!!!' );
}
$count = count( $incoming );
$count = ($count + ($count - $count)) + 1; // ok we have added 1.
return reset( $incoming );
}
function hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArr ayWeWouldntWantAnyAccidentsNowWouldWe( $incoming )
{
if (is_array($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_bool($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_callable($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_float($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_int($incoming)) return "YES IT IS AN INTEGER";
if (is_null($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_numeric($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_object($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_resource($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_string($incoming)) return "NO IT IS NOT AN INTEGER";
exit( 'I DON\'T KNOW WHAT IT IS' );
}
function makeReallySureTheThingComingInIsActuallyAnArray( $incoming )
{
for( $i = 0; $i < 200; $i++ ) {
if( is_array( $incoming ) === true ) {
// Hmm it might be! let's make sure!
if( is_bool( $incoming ) === false ) {
if( is_callable( $incoming ) === false ) {
if( is_double( $incoming ) === false ) {
if( is_float( $incoming ) === false ) {
if( is_int( $incoming ) === false ) {
if( is_integer( $incoming ) === false ) {
if( is_long( $incoming ) === false ) {
if( is_null( $incoming ) === false ) {
if( is_numeric( $incoming ) === false ) {
if( is_object( $incoming ) === false ) {
if( is_real( $incoming ) === false ) {
if( is_resource( $incoming ) === false ) {
if( is_scalar( $incoming ) === false ) {
if( is_string( $incoming ) === false ) {
// ok we cool
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
}
return true;
}
}
$num[ 1 ] = new ArrayBuilder();
$num[ 2 ] = new ArrayBuilder();
$theNumber[ 1 ] = $num[ 1 ]->parseArray( array(
$numberOne
) );
$theNumber[ 2 ] = $num[ 2 ]->parseArray( array(
$numberTwo
) );
$addition = new Addition();
$addition->addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayF irst( (int)(integer)$theNumber[1], (int)(integer)$theNumber[2] );
// oops i frogt to assign it a value!
$newAddition = new Addition();
$theEndValue = $newAddition->addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayF irst( (int)(integer)$theNumber[1], (int)(integer)$theNumber[2] );
echo $theEndValue . ' IS THE NUMBER YOU WANTED TO FIND BY ADDITION';
exit(01189998819991197253);
Edited by HotelUser (Forum Super Moderator): Thread moved from "Technology Discussion".
$numberOne = 1;
$numberTwo = 2;
class Addition
{
function __construct()
{
$true = true;
$false = false;
// make REALLy sure our variables are correct!!!!!
for( $i = 0; $i < 200; $i++ ) {
if( $true !== true ) {
exit( 'OH NO' );
}
if( $false !== false ) {
exit( 'OH NO' );
}
}
}
function addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayF irst( $numberOne, $numberTwo )
{
$numberOneCheck = new ArrayBuilder();
$numberTwoCheck = new ArrayBuilder();
if( $numberOneCheck->hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArr ayWeWouldntWantAnyAccidentsNowWouldWe( $numberOne ) === 'NO IT IS NOT AN INTEGER' )
{ exit( 'AAAAAAAARGH IT IS NOT A NUMBER' ); }
if( $numberTwoCheck->hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArr ayWeWouldntWantAnyAccidentsNowWouldWe( $numberTwo ) === 'NO IT IS NOT AN INTEGER' )
{ exit( 'AAAAAAAARGH IT IS NOT A NUMBER' ); }
$numberOne = (int)$numberOne;
$numberTwo = (int)$numberTwo;
$newResult = $numberOne + $numberTwo;
$newResult = (int)$newResult;
if( ((int)$newResult - ((int)$numberOne + (int)$numberTwo)) === (int)0 ) {
return (string)$newResult;
}
}
}
class ArrayBuilder
{
function __construct()
{
$true = true;
$false = false;
// make REALLy sure our variables are correct!!!!!
for( $i = 0; $i < 200; $i++ ) {
if( $true !== true ) {
exit( 'OH NO' );
}
if( $false !== false ) {
exit( 'OH NO' );
}
}
}
function parseArray( $incoming )
{
if( $this->makeReallySureTheThingComingInIsActuallyAnArray( $incoming ) !== true ) {
exit( 'OH NO IT\'S NOT REALLY AN ARRAY :(' );
}
// ok let's just make sure it isn't really trying to hdie
if( $this->makeReallySureTheThingComingInIsActuallyAnArray( $incoming ) !== true ) {
exit( 'haha you thought you could catch me out you cannot i have found out you are not an array mr. not array!!!' );
}
$count = count( $incoming );
$count = ($count + ($count - $count)) + 1; // ok we have added 1.
return reset( $incoming );
}
function hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArr ayWeWouldntWantAnyAccidentsNowWouldWe( $incoming )
{
if (is_array($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_bool($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_callable($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_float($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_int($incoming)) return "YES IT IS AN INTEGER";
if (is_null($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_numeric($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_object($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_resource($incoming)) return "NO IT IS NOT AN INTEGER";
if (is_string($incoming)) return "NO IT IS NOT AN INTEGER";
exit( 'I DON\'T KNOW WHAT IT IS' );
}
function makeReallySureTheThingComingInIsActuallyAnArray( $incoming )
{
for( $i = 0; $i < 200; $i++ ) {
if( is_array( $incoming ) === true ) {
// Hmm it might be! let's make sure!
if( is_bool( $incoming ) === false ) {
if( is_callable( $incoming ) === false ) {
if( is_double( $incoming ) === false ) {
if( is_float( $incoming ) === false ) {
if( is_int( $incoming ) === false ) {
if( is_integer( $incoming ) === false ) {
if( is_long( $incoming ) === false ) {
if( is_null( $incoming ) === false ) {
if( is_numeric( $incoming ) === false ) {
if( is_object( $incoming ) === false ) {
if( is_real( $incoming ) === false ) {
if( is_resource( $incoming ) === false ) {
if( is_scalar( $incoming ) === false ) {
if( is_string( $incoming ) === false ) {
// ok we cool
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
} else { exit( 'OH NO' ); }
}
return true;
}
}
$num[ 1 ] = new ArrayBuilder();
$num[ 2 ] = new ArrayBuilder();
$theNumber[ 1 ] = $num[ 1 ]->parseArray( array(
$numberOne
) );
$theNumber[ 2 ] = $num[ 2 ]->parseArray( array(
$numberTwo
) );
$addition = new Addition();
$addition->addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayF irst( (int)(integer)$theNumber[1], (int)(integer)$theNumber[2] );
// oops i frogt to assign it a value!
$newAddition = new Addition();
$theEndValue = $newAddition->addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayF irst( (int)(integer)$theNumber[1], (int)(integer)$theNumber[2] );
echo $theEndValue . ' IS THE NUMBER YOU WANTED TO FIND BY ADDITION';
exit(01189998819991197253);
Edited by HotelUser (Forum Super Moderator): Thread moved from "Technology Discussion".