php5

PHP static objects giving a fatal error

I have the following PHP code; <?php component_customer_init(); component_customer_go(); function component_customer_init() { $customer = Customer::getInstance(); $customer->set(1); } function component_customer_go() { $customer = Customer::getInstance(); $customer->get(); } class Customer { public $id; stati...

French date format

I am a newbie in PHP & wordpress. I wanted to know how to make this codde renders the date formating in french (e.g. 5 Fev) when your on the french side but in english format in English (e.g. Jan 5) Here is my code: <?php if (strtolower(ICL_LANGUAGE_CODE) == 'en') {$sidePosts = get_posts('cat=3,4,5,19&posts_per_page=5&order=DESC&orderb...

Uncaught exception while using xdebug

I'm not too great with xdebug so forgive me if this is a stupid question. But I installed it on a separate machine and it performed some magic for me like formating my var_dump() output and catching any uncaught exceptions. It also fails to format the stack traces, outputting plain text which is extremely hard to read. As I am learning ...

PHP array manipulation

I have the code below . it looks for the case and creates an array of rows and columns. $pv->results[$row1][1][0] actually is $pv->result->[rownumber][coulmnnumber][0]. Now this is for only 2 columns as you can see. However I want an array like $myArr = array(0=>1, 1=>7, 2=>8, 3=>9 ) to be added below for column. What it is doing, ...

Zend Framework - Deny access to folders other than public folder

All, I have the following Zend application structure: helloworld - application - configs - controllers - models - layouts - include - library - public - .htaccess - index.php - design - .htaccess Currently, if the user visits, http://localhost, my .htaccess files above make sure, the request is route...

Getting the variable name of an instantiated class in PHP

Hi, Is it possible to get the variable name used to reference an instantiated class from within the class? here's an example of what i mean: class Test { function getName(){ //some code here to get the name '$test1' in this example } } $test1 = new Test It's not a must for this to be possible, but it'd help for a project ...

Zend - Deny access to CSS, JS, Image files

All, I have the following Zend application structure: helloworld - application - configs - controllers - models - layouts - include - library - public - design -- css -- site.css -- js -- global.js -- images -- siteheader.gif -- sitefooter.gif ...

Php what does <<< mean ?

In the following code from http://us2.php.net/manual/en/language.oop5.properties.php what does the <<< symbol mean? <?php class SimpleClass { // invalid property declarations: public $var1 = 'hello ' . 'world'; public $var2 = <<<EOD hello world EOD; public $var3 = 1+2; public $var4 = self::myStaticMethod(); public $var...

PHP curly string syntax question

I'm running PHP 5.3.0. I've found that the curly string syntax only works when the first character of the expression is $. Is there a way to include other types of expressions (function calls, etc)? Trivial example: <?php $x = '05'; echo "{$x}"; // works as expected echo "{intval($x)}"; // hoped for "5", got "{intval(05)}" ...

json_encode with mysql content and umlauts in utf-8

Hey, i feel my beard growing while trying to find out the Problem here. Basic the Problem is, that Umlauts/Special Signs äöß ... don't work. I guess everyone is sick and tired of that questions but all the solutions found online don't seem to work. Im having utf-8 content in a utf-8 Mysql Database. I feel the Problem ist somewhere in ...

Strip Javascript on(whatever) events from Code using PHP

Hi, I want to strip out all JavaScript from a small snippet (4-6 lines) of HTML, i've read on here before that its best not to use REGEX on HTML, so if anybody knows a better way, please advise. So for example i have the following code: <a href="go/to/my/link" onclick="fetchMeSomeData(this)">My Link</a> <p onfocus="doSomethingAmazing...

PHP File Upload, using the FILES superglobal array

Hello everybody, I just have a quick question. Let's say that I'm setting up an upload feature for a project. I'm using PHP5, and I was wondering if by using the $_FILES superglobal array, I could have access to the "tmp_name" array key , which is the temporary path and name of the file being uploaded to display a preview of the image,...

Debugger for IE7

I m using PHP5 & during testing on IE7 if some thing does no work then i can not find the bug quickly as i can do in FF (by the help of Firebug). Is there any tool for code debugging in IE7 like in FireFox we have firebug ? ...

Using curl_init in Zend Application is causing Session Error

Hey guys I'm getting this weird error in my Zend application with this piece of code: $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'www.xyz.com/ab.php'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $data = curl_exec($curl); curl_close($curl); if (!isset($location->country)) { $location = new Zend_Session_Namespace('lo...

Webcam Integration with php

Hi, I need to integrate the Web cam to the application. I need to take the user profile picture using the web cam. How can i do that. any one can help me? Thanks in advance, ...

Mysqli connection trying with different users

I'm trying to create a PHP class extending mysqli that is capable of connecting with another user if the connection fails. It is probably easier to explain with code: public function __construct() { $users = new ArrayObject(self::$user); $passwords = new ArrayObject(self::$pass); $itUser = $users->getIterator(); $itPass ...

Send email from localhost to Gmail.

I am new to PHP & want to we send email from localhost to my gmail address. I am using ubuntu 9.10 & have already installed libphp-phpmailer from Synaptic Package manager option. I used: $to = "[email protected]"; $subject = "Account Confirmation"; $headers = "From: [email protected]"; $message = "Testing"; $mail = mail($to, $subject, $m...

How to convert pdf to doc file in java

hi, need to convert a pdf file to a doc file. I found different type of example to generate pdf file but not got pdf to doc. please help me in this regard with good example or source code or guideline. ...

Postpone email when domains equal

HI. For a client i'm developing 4 different email agents for his web portal. I need to send a lot of emails to clients (couple of thousands in the future) which are stored in a database. Sending is fine, but I would like to work out a PHP script which sends emails, but also stores the previous email domain and if they equal than postpone...

distributed system programming with php

Hi guys, I'm doing a system for a hospital in my country as the final year project of my degree, my supervisor specially asked me to use php and mysql for this. i don't have any experience with distributed systems and php programming, can any one help me out to build my base and improove my knowledge stating some sites, books to refer t...