php5

Cookies concept

How to disable or clear the client browser Cookies using any technology may i think using javascript it will be usable to any techonology ...

php is not recognized as an intern command (using windows)

Hello, I want to develop using a framework called symfony BUT, i do not have a MAC and i don't want to dual boot with Debian. I tryed virtual hosts via Virtual Box but it's too crappy. So i decided to stay on windows So when the tutorial tells me to do php lib/vendor/symfony/data/bin/check_configuration.php i do in the windows cmd...

Permission denied while using mkdir on a windows server.

Hi, the problem is, im using a leased windows server, and im trying to create a directory using php function mkdir, whichever path i try gives the same result. im using absolute something like this. mkdir('D:\Hosting\3105674\html\lepsiprisma\hola',0777); this returns Warning: mkdir() [function.mkdir]: Permission denied in D:\Hosti...

Many-to-many relationships examples

I haven't found any MYSQL many-to-many relationships examples here and in google. What I am looking is to see a very simple example with php+mysql showing database's results. Can anybody write a very simple example? ...

PHP file modification time in milliseconds

I there, I am currently writing a unit test which asserts that a file did not get modified. The test code execution takes less than one second and therefore I would like to know if it is possible to retrieve the file modification time in milliseconds. filemtime() function returns the UNIX timestamp in seconds. My current solution is usi...

Hyphens in Keys of Object

I have an stdClass Object like this: stdClass Object ( [key-west] => 1 [disney-land] => 1 ) I am trying to retrieve the value like this: $objectName->key-west but the value returned is 0. Why? and How can I retrieve it as 1? Thanks ...

loading css or javascript from non-public directory

is there a way to load css and/or javascript files from outside of the public web directory? for example on my hosting service i have /public_html but don't want these files to exist in the public directory and want them in a directory outside of the public directory in a sibling directory /system (i am using codeigniter) within the /sy...

How do I know if an input sting is a method name of a specific class?

Inside an object, I get a string and I have to know if there is a method with the same name in the current object I am in. How do I do that? ...

PHP oop build array

Hi! If I would need to build up an array with OOP based PHP, would this be the proper way to do it? class MyClass { $array = array(); function addElement($value) { $this->array[] = $value; } function fetch() { $return = $this->memcached->getMulti($this->array); return $return; }...

PHP OOP: Chainable objects?

Hi everybody, I have tried to find a good introduction on chainable OOP objects in PHP, but without any good result yet. How can something like this be done? $this->className->add('1','value'); $this->className->type('string'); $this->classname->doStuff(); Or even: $this->className->add('1','value')->type('string')->doStuff(); Tha...

PHP OOP: Parenting objects/functions?

Hi everyone, How is parenting functions in PHP done properly according to the following example? Can I make sure that my array isn't overwritten and the previous values inside array lost, on each addArray call? function arraybase() { $this->array = new ArrayObject(); return $this; } function addArray($value) { parent::$t...

Sort directory listing using RecursiveDirectoryIterator

I'm using RecursiveDirectoryIterator and RecursiveIteratorIterator to build a file listing tree using code like below. I need to the list to be sorted - either directories then files alphabetically, or just alphabetically. Can anyone tell me how to sort the file list? $dir_iterator = new RecursiveDirectoryIterator($groupDirectory); $it...

append to an xml file with php

help im trying to write to a xml, here is my xml file.....please help <item> <entry> <title>test</title> <link>http://chuckjonescenter.org/blog_entry.php?blog_id=&lt;/link&gt; <pubDate></pubDate> <description></description> </entry> </item> ...

Why is there a constructor method if you can assign the values to variables?

I'm just learning PHP, and I'm confused about what the purpose of the __construct() method? If I can do this: class Bear { // define properties public $name = 'Bill'; public $weight = 200; // define methods public function eat($units) { echo $this->name." is eating ".$units." units of food... <br />"; ...

PHP: Find total number of images having same name in a folder.

Hi, I am creating code to upload images in a folder using PHP, & before upload an image I check that if any image with same name already exists in the folder by using below syntax: if (file_exists('profilephoto/' . 'frame.gif')) { } But actually I don't want to restrict the user to upload more images with same name & obviously it is ...

download and upload facebook profile photo

I`m new in API field. How can I log in facebook and download\upload profile picture with php? Thanx ...

parse youtube video id using preg_match

Hi, I am attempting to parse the video ID of a youtube URL using preg_match. I found a regular expression on this site that appears to work; (?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+ As shown in this pic: My PHP is as follows, but it doesn't work (gives Unknown modifier '[' error)... <? $subject = "http://www....

How do I move Zend Framework From Development to Production?

I'm just wondering if anyone else has had problems moving the Zend Framework from development to production. I changed my docroot to the public folder, updated my library path, but it's still not working out for me. The IndexController is working just fine, but my ServiceController is giving me an internal server error. ServiceCont...

Getting an argument list for a class method

What I'd like is for this class class Car { public function __construct(Engine $engine, Make $make, Model $model) { // stuff } } Get an array that has the types needed to construct this car (Engine, Make, Model) in the order they are needed for the constructor. I'm using this for a Dependency Injection-esque thin...

ctype_alpha but allow spaces(php)

I was wondering if one can allow spaces in a textfield when checking it with ctype_alpha. Since ctype_alpha only allows alphabetical letters, I don't know how to let the user enter space in the field. I did try using ctype_space but that didn't work. I simply want the user to be able to type only alphabets and they have a choice to inclu...