PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) (1316 Views)
1 Reply
| PHP Workouts-sqlite3 CLASSES (wrapping Or Extending) by Kidstell(op): 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(op): 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 |
[MOD] PHP WORKOUTS - String Manipulation 1 • [MOD] PHP Workouts-email Validation In Php Using Any Method. • Abstract, Interface And Adapter Classes • 2 • 3 • 4
App That Calculates GP, Matrix, Quadratic And Simultenous Eqs • School Management Software For Your Growing School • In Need Of A Programmer