Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,150,393 members, 7,808,383 topics. Date: Thursday, 25 April 2024 at 11:15 AM |
Nairaland Forum / Science/Technology / Programming / PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) (1220 Views)
[MOD] PHP WORKOUTS - String Manipulation 1 / [MOD] PHP Workouts-email Validation In Php Using Any Method. / Abstract, Interface And Adapter Classes (2) (3) (4)
(1) (Reply)
PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) by Kidstell: 12:13pm On Aug 27, 2013 |
These are ways of utilizing the sqlite3 class. Which will you choose and why or better still which of these is the BEST method 1 extending <?php class MyDB extends SQLite3{ function __construct(){ $this->open('test.db');} } $db =new MyDB(); if(!$db){ echo $db->lastErrorMsg(); }else{ echo "Opened database successfully\n"; } ?> method 2 wrapping class MyDb { function __construct(){ $data=new sqlite3(); $data->open('test.db');} } $db =new MyDB(); if(!$db){ echo $db->lastErrorMsg(); }else{ echo "Opened database successfully\n"; } ?> |
Re: PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) by Kidstell: 5:29pm On Sep 03, 2013 |
I used to think we 've got sure ethical programmers here. Why is nobody talking, there are no rules here. Well i will really like to use the Extend because it gives of access to predefined functions and i won't need to re-invent any wheel. Also i 'll be able to create functions that call the predefined functions without creating a new object instance of the sqlite3 class, this helps save ram space. Lets talk |
(1) (Reply)
Please Help On My Login Page / I Want To Become The Next Bill Gate / Python 2 Vs Python3
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 5 |