473,394 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Getting trouble with classes and functions

Dear all..

I've written this classes but I cannot get for desired result.

[PHP]class firstclass {

var $tmpdir;

function definetemp() {
$this->tmpdir = "tmp";
}

function deltree($path) {
if (is_dir($path)) {
$entries = scandir($path);
foreach ($entries as $entry) {
if ($entry != '.' && $entry != '..') {
deltree($path.DIRECTORY_SEPARATOR.$entry);
}
}
rmdir($path);
}
else {
unlink($path);
}
}

}

$classone = new firstclass();

class secondclass {

function action(){
global $classone;
// ? -> this should do action of deltree function <- ?
$classone->deltree($classone->tmpdir);
}

function whatever(){
// ...
}

}

$classtwo = new secondclass();


// call action function
$classtwo->action(); [/PHP]

please help me.
thank you.
Dec 2 '07 #1
5 1081
mwasif
802 Expert 512MB
Dear all..

I've written this classes but I cannot get for desired result.
What are your desired results?
Dec 2 '07 #2
I want operate deltree function...

[PHP]:
:
function action(){
global $classone;
// ? -> this codeline below can't get the $tmpdir value <- ?
$classone->deltree($classone->tmpdir);
}

:
:[/PHP]

called from..

[PHP]// call action function
$classtwo->action();[/PHP]

the problem is in 'action' function. :(
Dec 2 '07 #3
pbmods
5,821 Expert 4TB
Heya, Frozenade.

What do you want your code to do? Give an example.
What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Dec 2 '07 #4
hi pbmods,
could you test the script, please?

there's an error says "undefined function" in line $classone->deltree($classone->tmpdir);

i just want to fix this.
how to fix this error?

thank you
Dec 2 '07 #5
pbmods
5,821 Expert 4TB
Heya, Frozenade.

What's the error text? Is it "call to undefined function" or "call to undefined method"?

Side note: PHP 4 will be discontinued as of December 31. Check out the official PHP 5 migration guide.
Dec 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
303
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b....
1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
2
by: Jeff | last post by:
/* -------------------------------------------------------------------------- Hello, I was experimenting with class templates and specializing member functions and came across a simple problem...
14
by: Gregory L. Hansen | last post by:
I can't seem to make a queue of objects, using the STL queue. I'm trying to make a little event manager, and I just want someplace to store events. The method definitions for EventManager have...
3
by: Ilja Booij | last post by:
Hi all, I have some trouble with the following: I'm getting a time string, in YYYY-MM-DD HH:mm:ss format, which I need to translate into a string with DD-Mon-YYYY HH:mm:ss +HHMM, where the...
43
by: chookeater | last post by:
Hi All. My introduction to VB was through VB.Net but I am working with a lot of code that was written by programmers with pre-dotnet experience. As a result there are lots of function calls and...
9
by: Jordan Tiona | last post by:
I can't get this code to work right. It seems to be skipping some of the cin functions. Can someone help me with this? ClassTrack.cpp: #include <iostream> #include "ClassTrack.h" using...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.