1--TEST-- 2sqlite-oo: call method with $this 3--SKIPIF-- 4<?php # vim:ft=php 5if (!extension_loaded("sqlite")) print "skip"; 6?> 7--FILE-- 8<?php 9include "blankdb_oo.inc"; 10 11$db->query("CREATE TABLE strings(key VARCHAR(10), var VARCHAR(10))"); 12$db->query("INSERT INTO strings VALUES('foo', 'foo')"); 13 14class sqlite_help 15{ 16 function __construct($db){ 17 $this->db = $db; 18 $this->db->createFunction('link_keywords', array(&$this, 'linkers'), 1); 19 } 20 21 function getSingle($key) 22 { 23 return $this->db->singleQuery('SELECT link_keywords(var) FROM strings WHERE key=\''.$key.'\'', 1); 24 } 25 26 function linkers($str) 27 { 28 $str = str_replace('foo', 'bar', $str); 29 return $str; 30 } 31 32 function free() 33 { 34 unset($this->db); 35 } 36 37 function __destruct() 38 { 39 echo "DESTRUCTED\n"; 40 } 41} 42 43$obj = new sqlite_help($db); 44echo $obj->getSingle('foo')."\n"; 45$obj->free(); 46unset($obj); 47 48?> 49===DONE=== 50--EXPECT-- 51bar 52===DONE=== 53DESTRUCTED 54