php

How to Explode String Right to Left ?

$split_point = ' - '; $string = 'this is my - string - and more'; How can i make a split using the second instance of $split_point and not the first one. Can I specify somehow a right to left search? Best simple approach? Basically how do I explode from Right to Left. I want to pick up the last instance of " - ". Result I need: $ite...

Trouble using sandbox of symfony

I'm new to symfony and I am trying to run a simple command on the command line but I get an error message. When I try to execute the command: d:\new_xam\xampp\htdocs\sf_sandbox_1_2\sf_sandbox>symfony propel:build-model " I get the error: 'php.exe' is not recognized as an internal or external command,operable program or batch ...

How can I get the currently playing song from the audioscrobbler api?

I am using the zend framework to get info from the audioscrobbler api. The response format is like this: <recenttracks user="RJ"> <track nowplaying="true"> <artist mbid="2f9ecbed-27be-40e6-abca-6de49d50299e">Aretha Franklin</artist> <name>Sisters Are Doing It For Themselves</name> <mbid/> <album mbid=""/> <url>ww...

How can I resize an image already uploaded using Magickwand(PHP)/ImageMagick?

I am working on building gallery where the user uploads all the images. I had tried to use GD originally but found that it used way too much memory when dealing with images from a digital camera. So I have been looking into ImageMagick and ran into this problem. My end goal is to resize the image and then upload it. I am not sure i...

Colorizing and swapping colors with PHP GD Image Library?

Hello I am in the process of trying to colorize and swap colors on an image using GD image library with PHP. I am using an original image located here: http://korlon.com/youknowbetter/test.jpg And wish to get it to a point where it is orange face with black clothes and hair much like you see here: http://youknowdifferent.org/ So far ...

Get viewers local time with PHP?

I need to allow users to a commit a certain action on my website once a day and I'd like this it reset at midnight of the users' local timezone. What's the best way to accomplish this with PHP? ...

Kohana or CodeIgniter?

I'm looking for a PHP framework. I did a research here and found CodeIgniter would be best for me. But then I discovered that there is Kohana based on CodeIgniter. And I'm annoyed, because since Kohana is based on CodeIgniter, it should work similar, but it is optimized for PHP 5, so it should be faster in a PHP 5 environment. I was goi...

PHP: Get all variables defined in current scope/symbol table

Is there a function and/or object and/or extension in PHP that will let you view all the variabled defined in the current scope? Something like var_export($GLOBALS) but only showing variables in the current symbol table. ...

SFTP from within PHP

Hi guys, I'm in the process of building an web app that will, besides other things, need to connect to a FTP server to download or upload files. The application is written in PHP and it's hosted on a Linux server. What I was wondering is whether or not it would be possible to also provide support for SFTP servers, but after some quick ...

$_SERVER["SCRIPT_URI"] not working? alternative?

Hi, This is odd, but for some reason the $_SERVER["SCRIPT_URI"] will not return the domain name when I am in child/sub-pages but will only work on the main page. Not sure if its due to the script (WordPress) or host, but please can you suggest any reliable solution to retrieve the domain name with PHP? I am very thankful in advance, Re...

PHP script will not end when completed

I am working on an image upload script and ran into this problem. Using ImageMagick I would run out of time resizing and uploading images so I inserted these two lines: set_time_limit(120); ini_set('max_input_time', 120); Now however, the script never ends. It is continually running the page even though it uploads, resizes, and inse...

Including different types of files in PHP

I took over a PHP project and I'm trying to get it running on my dev box. I'm a developer and not a sysadmin, so I'm having trouble getting it working. The previous developer used .h files to include PHP. My current configuration is taking that .h file and including it without executing it. What do I need to look for in my apache con...

AJAX table update script

Hey, I'm making an online tile based game and I have just finished scripting the piece of code that takes the coordinates of where you are standing and builds the surroundings (tiles) around you (the game is made using a table with many cells that hold the tiles). I need some help creating a bit of AJAX that can refresh my table every ...

Choosing forum software based on modifiability

I am aware that this question will be judged as a non-programming question but I would like to point out that my software decision is very largely based on the programming standpoint. I am interested in changing from SMF to a better forum software. Unfortunately I'm unsure of which software I should choose. Many people like to recommend...

In PHP, how do I add to a zero-padded numeric string and preserve the zero padding?

If I have a variable in PHP containing 0001 and I add 1 to it, the result is 2 instead of 0002. How do I solve this problem? ...

How do i fetch my file's absolute path

Hello, say i have a file /var/www/foo/test.php how do i find out it's path from within it. i'm trying to create an "Add To Include Path" action, and for that i need absolute paths. ...

Warning: Assignment in condition

One thing that has always bugged me is that when checking my php scripts for problems I get the warning "bool-assign : Assignment in condition" and I get them a lot. e.g.: $guests = array(); $sql = "SELECT * FROM `guestlist`"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) $guests[] = $row['name']; Is there ...

Resize animated gif file without destroying animation

Hi guys, I need to resize a animated gif file without destroying the animation. Let I have a flower animated file name: flower.gif size is: 700x700, frame no: 5. I need to resize it 128x128 & 240x320 without destroy animation . Each resized animated file must hold same frame number as uploaded animated file. How can I do it using PHP?...

How can I convert my button into a hyperlink in PHP?

I need to replace a button on my web page with a hyperlink. I am calling a PHP script using the button. I extract the id using the following statement: $id = $_POST['id']; HTML code: <form id="test1" method="post" action="my.php?action=show"> <input type="hidden" name="id" id="id" value="1" /> <input type="submit" name="submit" ...

Where can I find some good tutorials to learn object orientated programming particularly for php?

I've been looking to improve my programming habits and I heard that OO is the way to go. Also I'd much prefer online tutorials over books. ...