Passing Objects into PHP constructor error

Is it possible to pass an object into the constructor of a PHP class, and set that object as a global variable that can be used by the rest of the functions in the class?
For example:
class test {

function __construct($arg1, $arg2, $arg3) {
global $DB, $ode, $sel;


Why PHP 3D Array has ‘z’ not be defined?

Pulled data below should return:


But as last line var_dump($result_value); returns with no z:


What am I missing here for having ‘z’ in $result_value?
$pullMapInfo = “SELECT x, y, z, value FROM mapinfo WHERE id=’{$player_id}’”;
$pullMapInfo2 = mysql_query($pullMapInfo) or die($error[4]);

//create an array with all x, y, z

Sleep in javascript loop?

I’ll start by explaining what is it that I’m trying to do
My application is implemented using PHP (Zend framework) and Javascript. I want to make a questionnaire for my application and so far I have done the following:
My page consists of series of <div class=’question #’> elements where # denotes the index of [...]

PHP SQL: Way to skip over section of a query if variable is blank

I’m writing a query that uses input from a search form where Brand, Type and Price are optional input fields:
SELECT * FROM `database` WHERE `brand` LIKE “%’ . $brand . ‘%” AND `type` LIKE “%’ . $type. ‘%” AND `price` LIKE “%’ . $price . ‘%”

I am wondering if there is a way to say [...]

dynamically created button hide in php

I have created button using this:

echo ‘<td><img src=”‘.$path.$row['photo'].’” border=”0″ width=100 height=50/></td>’;
echo $row['fname'];
echo “<input type=\”button\” value=\”send request\” name=\”$i\” onclick=\”sendreq(‘”.$row['uname'].”‘)\”/>”;
//echo $i;
echo “<br/>”;

and passing the username onclick of the button [...]

Deleting records in yiiframework model by column

How can I delete records in yiiframework when users logged-out in Whosloggedin model by column username?
table – whosloggedin
CREATE TABLE `erc_whosloggedin` (
`id` int(11) DEFAULT NULL,
`username` varchar(50) DEFAULT NULL,
`complete_name` varchar(95) DEFAULT NULL,
`date` date DEFAULT NULL,
`time` time DEFAULT NULL

I Have tried something like this

Configuring MNPP nginx.conf to work with Codeigniter/PHP

I have a standard Codeigniter installation but can’t seem to get MNPP (MySQL+Nginx+PHP+Python) to recognize it. I saw there is a codeigniter config in MNPP’s common folder but can’t get MNPP make use of those settings either.
I’ve gotten my Codeigniter app to work using Nginx on an EC2 instance so its not a problem with [...]

Compare Day with day and find Next date of Day in PHP

I’m working with dates in php and I’m a little stumped
This is my code:
$day = ‘Thursday’;
$i = 0;
$o_date = new DateTime(“2012-09-12 20:56:43 +18 hours”);
$date = date_format($o_date, ‘l’);
$full = date_format($o_date, ‘d-m-Y’);
if($day!=$date) {
$date = new DateTime($date . ” +1 days”);
$order_day = new DateTime($full . ” +”.$i.” days”);$order_day = date_format($order_day, [...]

Magento Custom Option label in Shopping Cart

I have simple products with custom options (in this case it’s color). They are NOT configurable products. If you are unsure what I mean by custom options see this:
They are custom options (not Attributes).
I would like the label (i.e. green or red or blue) of the chosen option to be displayed next to the SKU [...]

How to explode a string with commas and recompose except the first one

I have a string like this [tubelist dijfisj, ijdsifjad, ajkdfksd, sdjfkdf] and I would like to separate them into two ###URL### and ###URL2###.
This is the code I got so far
function xyz_plugin_callback($match)
$tag_parts = explode(“,”, rtrim($match[0], “]”));
$output = YOUX_TARGET;
$output = str_replace(“###URL###”, $tag_parts[1], $output);
$output = str_replace(“###URL2###”, $tag_parts[2], $output);

$match is the [...]

Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.