php5

how to remove all images from an array with -c

I am using the code below to create an array of images. Id love to be able to NOT add any images with -c.jpg in the filename. Can anyone help get this up and running? I am using PHP 5 <?php $jsarray = array(); $iterator = new DirectoryIterator(dirname("public/images/portfolio/all/")); foreach ($iterator as $fileinfo) { if ($filein...

random image from an array PHP5

This array is being created correctly, although i need to pick one then print it which isnt happening for me...any ideas? <?php $bgimagearray = array(); $iterator = new DirectoryIterator("/home/sites/yellostudio.co.uk/public_html/public/themes/yello/images/backgrounds"); foreach ($iterator as $fileinfo) { if ($fileinfo->isFile() && ...

Singleton in Conjunction with the Factory Pattern in PHP5

What is the best method for using singleton design pattern in conjunction with the factory method pattern in PHP5? My simplest usage scenario for this is instantiation selective database connection only once for each database type. ...

Increasing Upload speed with apache, PHP and HTML

Hi all, I have created html page for Updloadind some files. when i am using it with localhost upload is very fast But when i try to access the site from other machine with IP i s very slow in uploading same file Please suggest to fix this issue. Regard Hemant ...

Error help in PHP

i have an eroor in sending data using textbox by POST to data base ERROR IS"NOTICE:UNDEFINED INDEX ON LINE" plz help me any one how can i solve this problem THIS IS MY CODE <?php error_reporting(0); $con = mysql_connect("localhost","root",""); mysql_select_db("hello", $con); $result = mysql_query("SELECT Max(id) as id from `aoa` WHERE...

eBay Markdown Manager via API

Using PHP5, how can I use the eBay API to set all my 2000+ eBay Store items on sale except for a specific set of 45 items? I can't find a way to do this on eBay's website, and would prefer an API method so that I can simply exclude a specific brand from my query. ...

Monitoring apache's load with php

UPDATE: thanks to all the answer given, but they are all about the system load, and not the apache. My goal is to understand, inside my php scripts (the templating ones), when apache have an high load and is prefearrable to fork some traffic on lighttpd, that is here just to the long-polling and to light the apache's load. Hi guys, aft...

Php abstract class site configuration

Hi, i have a config class which is an abstract class. I would like to set it up so it automatically detects which server the site is on and then assigns appropriate constants. I get an error on line ten $this->hostName = $_SERVER['SERVER_NAME']; expecting `T_FUNCTION. What is the correct way to do this and is there a better way to do thi...

Google Geocode: PHP Implimentation - character encoding issues

Hello, I'm working with UK address data and also International address data. I need to geocode the address data for use on a google map. I'm doing this using the HTTP service. Ie/ Constructing a query string and passing it to file_get_contents($THEURL). I've managed to geocode 80% of the address data perfectly, however those addresse...

best method to manipulate array keys in PHP

I have an associative array. I need to add ':' to the start of all the keys. What would be the fastest/simplest way of doing this? And what would be the most efficient way to do this? ...

What is the best and most universal way to unzip an archive using php 5?

I'm writing software that requires the user to have php 5, but nothing else in the way of extra apache modules, etc. Is there a vanilla php5 method for unzipping an archive? I found this: http://nz2.php.net/manual/en/function.ziparchive-extractto.php But can everyone using php 5 use this? No extra modules necessary? ...

PHP FILE HANDLING ERROR - Unable to figure out

function Random_N() { $RandomNumber = mt_rand(1, 9999); return 'temp_file/$RandomNumber.html'; } global $file_name; $file_name=Random_N(); $file = fopen($file_name, 'w+'); $text=$msg1; fwrite($file, $text); $_SESSION['body']=$msg1; $_SESSION['file_name1']=$file_name; ...

"Catchall" Properties in C#?

Is it possible to create a "catchall" getter property in C#? class xyzFactory { public static object this.*(string name){ get { return new name();} } } In PHP you would write something like //static getters are new to 5.3, so I didn't put it here. class xyzFactory{ public _get($name){ return $name();} } ...

Getting last 6 values from an multidimensional array

I have a need to get the last 6 values from an multidimentional array, I was trying to do something like this for($i=0;$i<6;$i++){ $stats = array_shift($stats); } But then after the first array_shift I get the following error PHP Warning: array_shift(): The argument should be an array Are there any functions that could do ...

for Single and Multiple Sizes of an Item

I am using a PHP Compoment, that accepts an ItemID and Return the Product Price. Now I have to Change the component so that the product may have a Standard Size or May Have Multiple Size. For example Watch has Standard (No Size) but Shoes May have Sizes like 5,6,7,.... And Depending on the Sizes the prices are also different. What ...

curl not sending cookie value

hiii.. i am tring to read a cookie value whic i got after login by sending post request then i want to sent this cookie value with post request using curl to another action . but after sending this when i am trying to see all posted header it does display that i have send any cookie value . this value is not available to my poste...

Thoughts on Abandoning Proprietary Framework for A Larger Open Source Project

We have been going back and forth a lot around our office lately about abandoning a proprietary framework that was developed here a couple of years ago and move to something that is larger and community supported. Our current solution was built to include only the things we need and is very flexible, by flexible i mean that it is loose...

What is this string: Ôªø and how do I avoid it?

Somehow I managed to stick Ôªø at the top of a PHP script. What is that horrifying group of characters, how could I have entered it, and how can I expose and/or avoid it in the future? Anecdotally, it was lurking at the very top of a PHP script, before <?php. The script needed to send a Content-type header. Because Ôªø pushed the header...

Any PHP MVC framework planning to use 5.3 features?

I would like to get started with PHP, and 5.3 release seems to bring many nice features (namespaces, lambda functions, and many others). I have found some MVC frameworks, and some of them support only PHP 5: PHP Frameworks PHP MVC Frameworks Model–view–controller on Wikipedia but can anyone recommend one of those MVC frameworks that...

php function that separates a string into different strings?

lets say i have this string here: $string = 'hello my name is "nicholas cage"'. i want to separate the words into difference strings like this: $word1 = 'hello'; $word2 = 'my'; $word3 = 'name'; $word4 = 'is'; $word5 = 'nicholas cage'; For fhe first 4 words I can use explode. but how do i do with word5? I want the first and last name ...