php5

I'm looking for a textbook based introduction to the php 5.3.2? Any suggestions?

By textbook based i mean the author asks the reader questions/mini projects after every section/chapter of the book. And the book includes background info on php 5, like what kind of language, its use, syntax/semantix/structure etc. Any suggestions? ...

Do PHP 4.4.9 based applications run on PHP 5.2.0 flawlessly?

I need to change upgrade the PHP version to at least 5.2.0 for my new magento OS Commerce installation, but would it mess up my current store which runs on 4.4.9 (PHPCart)? The real question is, can I upgrade without harming the old cart? ...

How to pass parameters in jquery

Hello. I am supposed to submit 2values called str and name to another page.But only 1value is getting returned in the next page.When i include name and on next page if i say print_r($_POST),then even the first value is not getting printed. I have written a fuction as follows,which works because there is only one parameter. function send...

Extending a singleton class

i used to create an instance of a singleton class like this: $Singleton = SingletonClassName::GetInstance(); and for non singleton class: $NonSingleton = new NonSingletonClassName; i think we should not differentiate how we create an instance of a class whether this is a singleton or not. if i look in perception of other class, i d...

PHP5 : Applying a method from an extended class on an object from the original (parent) class.

Hello, I'm trying to extend two native PHP5 classes (DOMDocument and DOMNode) to implement 2 methods (selectNodes and selectSingleNode) in order to make XPath queries easier. I thought it would be rather straighforward, but I'm stuck in a problem which I think is an OOP beginner's issue. class nDOMDocument extends DOMDocument { pub...

Zend Namespace - Check if Session Exists

All, I am using Zend Framework and Zend_Session to do global session management for my application. I plan to clear all sessions on logout and hence am using the following code: if($this->sessionExists()) { $this->destroy(); } But it seems like it's not doing a good job.. I am getting an error: PHP Warning: session_destroy(...

cURL is not grabbing XML data in proper format

Hi, I'm using the following code with cURL: function _getStatsDataXMLString($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setop...

PHP Script to resize transparent png images

Could anyone link me to a sample script that would allow be to resize PNG images containing transparency? Some scripts I tried create a black area in place where the image was transparent. ...

Why is PHP5 SQLite PDO silently failing on DB connection?

I have no idea why my code is failing silently. PDO and PDO SQLite are confirmed loaded. Errors are turned on and OTHER errors display. The SQLite file exists. Perms are set correctly. If I change the filename, PHP actually DOES create the file but still fails silently. No output or commands are excecuted after the "$dbh = new PDO(...

Good suggestions for learning OOP PHP

I've been trying to learn PHP OOP and have looked at multiple articles, but have yet to find a good resource for learning. I want to learn from the user of setters and getters, $this->, constructors, and so on...! Can anyone please suggest me something? I noticed MOST teachings leave out the explanation of $this->. I want to learn magic ...

DOM: how to import nodes and give them different namespace prefix

I'm familiar with the DOMDocument::importNode method for importing a tree of nodes from some other document element. However, what I was wondering is if I can automatically change the namespace prefix on a tree of nodes as I import them, that is, specify a new prefix for all nodes of that namespace. Say the nodes, in their existing doc...

Order object simplexml_load_file by field of this.

Hi i have a problems with simplexml_load_file, i'm not pretty sure how to do to order my array by a $item->padre. I need to do foreach and order by $item->padre.=, i don't know how to do this. function create_sitemap($sitemap){ $xml = file_exists('sitemap.xml') ? $xml = simplexml_load_file('sitemap.xml'): exit('Failed to open sitema...

I'm looking for a textbook based introduction to the php 5? Any suggestions?

By textbook based i mean the author asks the reader questions/mini projects after every section/chapter of the book. And the book includes background info on php 5, like what kind of language, its use, syntax/semantix/structure etc. Any suggestions? ...

PHP: how can a class reference its own name?

In PHP, how can a class reference its own name? For example, what would the method look like to do this? Dog::sayOwnClassName(); //echos "Dog"; Update I see that everyone is saying get_class($this). But that's not correct. That would work if I were creating an instance of Dog. I'm asking about calling a method of the Dog class itsel...

How to return Current Object in a Static function in PHP

I neet access to current object in a static method. Code: protected static $name; public static function name($modulename) { self::$name = $modulename; } public function __call($name, $arguments) { $me = new test(self::$name); return $me->$name($arguments); } I want to be able to call method log in Log class. Like this...

Order SimpleXMLElement by element

Hi everyone I need to order a SimpleXMLElement by a node called padre like this. $xml = new SimpleXMLElement('sitemap.xml',null,true); sort($xml, "padre" ); foreach($xml as $url ) { echo "loc}' title='".rescue_name($url->loc)."'>".rescue_name($url->loc)." {$url->padre}"; } I don't know why is not work...

PHP getting blank pages after submit a form + signal Segmentation fault (11)

I few days ago I update my macbook pro to snow leopard, and since then some php files are not showing. This is what happens: I created a php form, when going to 'http://localhost/webform.php' I can see the form just fine. Then, once I submit the form, I just get a blank page. I enable error and warnings reporting under php.ini to mak...

session_start();echo SID; outputs a blank page on refresh !?

when I run this code for the first time <?php session_start(); echo SID; ?> , I get some thing like: PHPSESSID=9o2bhrqmln2j52caspdhholhk7 but when I refresh I get a blank page Until I remove the PHPSESSION cookie and start a new one ... is that normal or I have a problem ? ...

Wordpress nav not visible in pages like articles, blog & search

My wordpress*(a custom template)* nav is all working on all of the pages but now I found out that the Main nav doesn't show on this pages All pages e.g. search.php, single.php, index.php, page.php all has <?php get_header(); ?> I really don't know whats wrong. Here is the code for my header.php <?php /** * @package WordPress *...

PHP : How to Get object or class name

right now, i have this code where $obj_arr maybe contain array and object. $obj_temp = array ($obj_identity, $arr_user, $obj_locale, $arr_query); foreach ($obj_temp as $maybe_arr) { if (is_array($maybe_arr)) : $name = (string) key($maybe_arr); if (is_object($maybe_arr)) : ...