Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

wanting to get into php any pointers???

Name: Anonymous 2011-02-08 8:40

Hey there /prog/!

So here's my story: I'm a java programmer at my friend's dad's coffee shop although I haven't heard from my friend in a while (who I'm very good friends with, it's how I got the job in the first place). I work as a tech support guy for their wifi systems and I also do a few other jobs such as cleaning the shop laptop and just making sure everything runs smoothly, nothing really challenging, your absolute most basic stuff, basically I get paid $11/hr to sit around and do nothing and I've been doing this for 4 years now.

Now my friend went off to college and I haven't spoken to him in quite a while and I'm getting really bad signals from his parents who obviously want me gone. Basically what I want is a job that is both intellectually stimulating and a good place to learn new skills, while I like sitting around doing nothing, I truly feel a person of my intellect and skill would be better suited working for a big company earning higher pay than what I do now.

For example, here's a problem I had to overcome:
I had the customer laptop handed back to me after an middle eastern looking customer left and he'd changed the language to Arabic. Now I Googled about and did the regular checks (Windows Search Bar + looking through Control Panel) and I couldn't find out how to do it and my friend's dad hates arabs (he barely made it through the man's visit without yelling at him to get out!) so I had to hide the laptop for a few days until I finally figured out that I needed to reinstall the Operating Systems onto the laptop. I did this and now the laptop works just fine with the English language pack.

I understand that Google or Microsoft might have the people that would cater to my intellectual needs. Please advise me on what I should do, /prog/!

So I want to get into the php thing because I hear that website programmers make good money but nobody wants to spend the time to learn java on those kinds of systems so I started reading about php and it looks kinda cool here's something I wrote:


<?php
$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 addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayFirst( $numberOne, $numberTwo )
    {
       
        $numberOneCheck = new ArrayBuilder();
        $numberTwoCheck = new ArrayBuilder();
       
        if( $numberOneCheck->hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArrayWeWouldntWantAnyAccidentsNowWouldWe( $numberOne ) === 'NO IT IS NOT AN INTEGER' )
        { exit( 'IT IS NOT A NUMBER' ); }
       
        if( $numberTwoCheck->hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArrayWeWouldntWantAnyAccidentsNowWouldWe( $numberTwo ) === 'NO IT IS NOT AN INTEGER' )
        { exit( '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 hiFunctionPleaseMakeSureThisIsAnIntegerAndNotAnArrayWeWouldntWantAnyAccidentsNowWouldWe( $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->addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayFirst( (int)(integer)$theNumber[1], (int)(integer)$theNumber[2] );

// oops i frogt to assign it a value!
$newAddition = new Addition();
$theEndValue = $newAddition->addTwoNumbersTogetherButMakeSureTheyAreNotAnArrayFirst( (int)(integer)$theNumber[1], (int)(integer)$theNumber[2] );


echo $theEndValue . ' IS THE NUMBER YOU WANTED TO FIND BY ADDITION';

exit(1);
?>

Name: sage 2011-02-08 8:42

any pointers? nope, unfortunately PHP doesn't have pointers.  Try a REAL programming language like C

Name: Anonymous 2011-02-08 8:46

real PHP programmers use PERL

Name: Anonymous 2011-02-08 8:49

Real PHP programmers do they even exist?

Name: Anonymous 2011-02-08 8:51

>>1-5
VALID PERL CODE

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List