Forum Moderators: coopster

Message Too Old, No Replies

Php Wrapper?

What is it?

         

Icarion

6:17 pm on May 3, 2010 (gmt 0)

10+ Year Member



Is a php wrapper a php page
pulling in say an in html page as
an include?

Thanks

eelixduppy

6:39 pm on May 3, 2010 (gmt 0)



A PHP wrapper is what it sounds like: code that surrounds other code. It could be a class or a function. It isn't anything specific. It's just code that surrounds (usually code that is already written, e.g. the Smarty Class) that performs some added functionality than what the base code does.

CyBerAliEn

7:21 pm on May 3, 2010 (gmt 0)

10+ Year Member



eelixduppy is correct. It is fundamentally ~any~ code that encloses or utilizes some other piece of code. And as he points out, it is not something specific. A "wrapper" is not like a "function", "class", "variable", "array", etc... it isn't anything specific --- it is terminology (like the term "polymorphism", it basically describes something).

Suppose you had two functions... "getWhales" and "getAnimal". And you had code like:
function getWhales()
{
return getAnimal('whales');
}


This is a very, very simple demonstration. But you could say: "getWhales() is a wrapper of getAnimal()". Get the idea? 'whales' "wraps" around 'animal' in some way, hence you could call it a wrapper. Though note, this code is incredibly simplistic. You could have a 'wrapper' that is incredibly more complicated and advanced.

Usually... in practice: a "wrapper" is a function/method/class that you have coded, the usually wraps itself around (utilizes) some other code that someone else has written (function, object, class, etc).

Icarion

7:24 pm on May 3, 2010 (gmt 0)

10+ Year Member



Thanks guys!