Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: PHP

  1. Registered TeamPlayer tugowar's Avatar
    Join Date
    11-01-11
    Posts
    152
    Post Thanks / Like
    Stat Links

    PHP
    #1

    PHP

    Are there any rocking PHP developers who hang around here?

  2. Registered TeamPlayer CivilWars's Avatar
    Join Date
    02-13-07
    Location
    Fort Worth, TX
    Posts
    42,785
    Post Thanks / Like
    Blog Entries
    5
    Stat Links

    PHP PHP PHP PHP PHP PHP PHP
    Gamer IDs

    Steam ID: CivilWars CivilWars's Originid: CivilWars
    #2
    Bunni I our resident php guru. Not sure who else is a pro.


    Sent from my UrMoms using Tapatalk


  3. Registered TeamPlayer tugowar's Avatar
    Join Date
    11-01-11
    Posts
    152
    Post Thanks / Like
    Stat Links

    PHP
    #3

    Re: PHP

    I've been doing procedural PHP for about a decade, but I just made the switch to OO in the last few months, and I'm realizing just how much I was missing. In between spamming these forums, that's what I'm doing.

  4. Registered TeamPlayer Cojiro's Avatar
    Join Date
    11-02-07
    Posts
    9,296
    Post Thanks / Like
    Stat Links

    PHP PHP PHP PHP
    Gamer IDs

    PSN ID: Cojiro918 Steam ID: dirtycojiro Cojiro's Originid: CojiroX918
    #4

    Re: PHP

    bunni is our resident expert everything.

    if you need help with anything just assume bunni knows the answer.

    computers broken? ask bunni
    wanna make a laser? ask bunni
    erectile dysfunction? ask bunni


  5. Administrator Bunni's Avatar
    Join Date
    08-29-07
    Posts
    14,279
    Post Thanks / Like
    Blog Entries
    7
    Stat Links

    PHP PHP PHP PHP PHP
    Gamer IDs

    Steam ID: bunni Bunni's Originid: Dr_Bunni
    #5

    Re: PHP

    sup? i know waaaay tooo much about php >.>, soo much its embarassing, i've even written a couple of extensions. If you've got some questions im down for it, as long as its not another "i need a website can you build it"

    Quote Originally Posted by Cojiro View Post
    bunni is our resident expert everything.

    if you need help with anything just assume bunni knows the answer.

    computers broken? ask bunni
    wanna make a laser? ask bunni
    erectile dysfunction? ask bunni
    Shit might make that my signature XD

  6. Registered TeamPlayer DancingCorpse's Avatar
    Join Date
    10-21-08
    Location
    Waco, Texas
    Posts
    12,228
    Post Thanks / Like
    Blog Entries
    6
    Stat Links

    PHP PHP PHP PHP PHP PHP
    Gamer IDs

    Gamertag: Dancin Corpse Steam ID: deltacorpse DancingCorpse's Originid: DancingCorpse
    #6

    Re: PHP

    Quote Originally Posted by Cojiro View Post
    bunni is our resident expert everything.

    if you need help with anything just assume bunni knows the answer.

    computers broken? ask bunni
    wanna make a laser? ask bunni
    erectile dysfunction? ask bunni
    Bunni cured my sick Wifi.

    Then I punched him, because it was supposed to be sick, and I had no internet because of it.
    Last edited by DancingCorpse; 11-07-11 at 07:33 PM.

  7. Registered TeamPlayer DJ Ms. White's Avatar
    Join Date
    11-13-07
    Location
    Plano, TX and Ruston, LA
    Posts
    32,364
    Post Thanks / Like
    Blog Entries
    43
    Stat Links

    PHP PHP PHP PHP
    Gamer IDs

    Steam ID: DJMrWhite
    #7

    Re: PHP

    Quote Originally Posted by Bunni View Post
    sup? i know waaaay tooo much about php >.>, soo much its embarassing, i've even written a couple of extensions. If you've got some questions im down for it, as long as its not another "i need a website can you build it"



    Shit might make that my signature XD
    Yeah, but you know that if you change it you'll start to have the spam build up again.
    enf-Jesus its been like 12 minutes and you're already worried about stats?! :-P
    Bigdog-
    Sweet home Alabama you are an idiot.

  8. Registered TeamPlayer DonVitoJr's Avatar
    Join Date
    05-11-08
    Location
    Connecticut
    Posts
    2,021
    Post Thanks / Like
    Blog Entries
    4
    Stat Links

    PHP PHP PHP PHP
    Gamer IDs

    PSN ID: Gh0st0fRazgriz53 Steam ID: donvito186
    #8

    Re: PHP

    I got basic PHP skills. Im no pro, i'm self taught but i know my code when i see it.
    Quote Originally Posted by Guyver View Post
    Only five billion? Those poor, poor souls. We should send them a fruit basket.

  9. Registered TeamPlayer tugowar's Avatar
    Join Date
    11-01-11
    Posts
    152
    Post Thanks / Like
    Stat Links

    PHP
    #9

    Re: PHP

    Well, since you volunteered!

    What is the benefit of turning your database results into objects, like with PDO Statement Fetch Obj/class or using a composition pattern to turn it into an object, versus just Fetching the results into a normal 2 dimensional array and using the array?

    As I'm making the OOP jump, that is one thing that has alluded me.



    And finally, to brag, I spent today coding classes so I can write my sql statements in my logic layer like this and they're aliased from my database names:
    // Will do an insert bc no conditionals :
    // $result = $db->update( $sql->table('user')->set('userName','insert test2')->set('userPassword', 'aljkdajldajdlajfas') );
    // A select:
    // $result = $db->find( $sql->table('user')->select('user_id')->field('userName')->eq('aw')->order('lajdfa')->limit('1') );
    // An Update:
    // $result = $db->update( $sql->table('user')->set('userId', '1')->field('userId')->eq('2') );

    For the code:
    Sharing my knowledge of PHP, HTML, CSS, XML, Java and more. - My Database Classes
    Last edited by tugowar; 11-07-11 at 08:34 PM.

  10. Administrator Bunni's Avatar
    Join Date
    08-29-07
    Posts
    14,279
    Post Thanks / Like
    Blog Entries
    7
    Stat Links

    PHP PHP PHP PHP PHP
    Gamer IDs

    Steam ID: bunni Bunni's Originid: Dr_Bunni
    #10

    Re: PHP

    Quote Originally Posted by tugowar View Post
    Well, since you volunteered!

    What is the benefit of turning your database results into objects, like with PDO Statement Fetch Obj/class or using a composition pattern to turn it into an object, versus just Fetching the results into a normal 2 dimensional array and using the array?

    As I'm making the OOP jump, that is one thing that has alluded me.



    And finally, to brag, I spent today coding classes so I can write my sql statements in my logic layer like this and they're aliased from my database names:
    // Will do an insert bc no conditionals :
    // $result = $db->update( $sql->table('user')->set('userName','insert test2')->set('userPassword', 'aljkdajldajdlajfas') );
    // A select:
    // $result = $db->find( $sql->table('user')->select('user_id')->field('userName')->eq('aw')->order('lajdfa')->limit('1') );
    // An Update:
    // $result = $db->update( $sql->table('user')->set('userId', '1')->field('userId')->eq('2') );

    For the code:
    Sharing my knowledge of PHP, HTML, CSS, XML, Java and more. - My Database Classes
    dont, there isnt, avoid oop approches in php, most are generally pointless. Good php is php thats built for speed, speed comes from avoiding complicated code, complicated code generally comes from trying to generalize a problem too much so you can make an object out of it.

    Especially trying to make a class that can write queries for you, which is silly (im putting that mildly), that code up there does not change, so why no just save php the work of having to go through that class 8-9 times per line just to generate a query that's static?You have to keep in mind that php is compiled on the fly when a page is called / required/included, every time a new initialization occurs . If i put that code on tpg on a gateway page, it'd be compiled nearly 900-1500 times a minute, thats a hell of a lot of work for generating a query thats gonna be run on a gateway page in addition to the actual work the page uses that query for.


    Honestly, i'd say php methodology is closer to that of say... lisp than any OO language. Php does support classes, but most people come from oop languages and thus abuse the feature, always keep in mind that code is compiled on the fly, your goal should be a balanace of KISS code (stuff is hardcoded) and making code easy to write and read (objects and classes).



    besides php has most of these things build straight in, PHP: MySQL Functions - Manual


    you can though, write a class to wrap the mysql functions, which is especially usefully for persistent connections to db's. My db wrappers are simple, with only a few functions such as $result=$db->query_read("select stuff from table"), or $db->query_write("update table set field where condition"), usually a $db->num_row($result), which merly wraps mysql_num_rows,

    finally a $row=$db->fetch_array($result), which wraps mysql_fetch_array i'd use like
    PHP Code:
    $games=array();
    $result $db->query_read("SELECT id, name, abbrv, enabled FROM " TABLE_PREFIX "rsma_games ORDER BY name asc");
        if (
    $db->num_rows($result) > 0)
        {
            while (
    $game $db->fetch_array($result))
            {
                
    $games[$game['id']]=array(
                    
    'name'=>$game['name'],
                    
    'abbrv'=>$game['name'],
                    
    'enabled'=>(int) $game['enabled'], //expect mysql results to be returned as strings, so cast this to int
                
    );
            }
    }

    $games would be populated here 
    which is just an example i wrote off the top of my head.


    even that i code i posted i get annoyed by, as table_prefix is rather dumb too, but thats a different story, regardless its proper methodology and produces efficient code.




    In addition to people forgetting that php is compiled during run time, people tend to forget that php, depending on the apache config is initalized many many times amongst apache children. For example, tpg is initalized several hundred times amongst all of apaches nodes. So its not just 1 instance of your program running, its hundreds, objects and classes only increase the amount of cpu and memory that ultimately ends up being used.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Title