?
Solved

function_exists within class

Posted on 2006-05-03
2
Medium Priority
?
351 Views
Last Modified: 2008-03-17
Hi,

Say I have:

<?php
$className = "MyClass";
$theObj = new $className();
// Here I want to check if a function (say, MyFunc) is available in the MyClass class. If yes, call the function and perform some actions.
?>

The scenario is quite complicated than explained here, but it should explain what I want to achieve. I know there is a function called function_exists(), but could that be used here? Or any other ideas?

Thank you all.
0
Comment
Question by:sangeetha
2 Comments
 
LVL 29

Accepted Solution

by:
TeRReF earned 1000 total points
ID: 16596302
In classes you use method_exists...
http://php.net/manual/en/function.method-exists.php
0
 
LVL 2

Author Comment

by:sangeetha
ID: 16596602
Thank you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question