Hi there, I have been trying to get my head around how simplexml and dom updates XML between functions. The reason i ask is that the code i have written seems to work, but without me having to declare anything as global, and im a little confused as to why it does this.
For example, i have this (simplified) code:
<?
foreach ($filename...
Why can't I immediately access elements in the array returned by explode()?
For example, this doesn't work:
$username = explode('.',$thread_user)[1];
//Parse error: syntax error, unexpected '[
But this code does:
$username = explode('.',$thread_user);
$username = $username[1];
I don't usually program in PHP, so this is rather co...
Hi,
I'm designing a website using PHP and MySQL currently and as the site proceeds I find myself adding more and more columns to the users table to store various variables.
Which got me thinking, is there a better way to store this information? Just to clarify, the information is global, can be affected by other users so cookies won't ...
hey mates
i want to start a PHP CMS project and we are 5 -6 ones , im looking for a solution to start this project as professional as can be , tasks can be saved - file storage and duration
do u suggest any online project management ?!
...
I am trying to attack this problem from a completely different angle, because it doesn't look like I can achieve my goal that way.
I want to loop over the item stack in the HeadScript View Helper, and make modifications to it. The documentation for this and some of the other view helpers makes this statement:
HeadScript overrides e...
This may be a simple answer, but I'm using jquery's $.ajax to call a PHP script. What i want to do is basically put that PHP script inside a function and call the PHP function from javascript.
<?php
if(isset($_POST['something'] {
//do something
}
?>
to this
<?php
function test() {
if(isset($_POST['something'] {
//d...
Are you allowed to locally store tweets obtained using the twitter api?
http://apiwiki.twitter.com/Twitter-Search-API-Method%3A-search
...
Hello
I want to do the following in PHP:
I have two images, a jpg and a png. I want to resize the jpg to the same size as the png then put the png on top. The PNG has transparency so I would like to preserve that so the jpg shows underneath.
If anyone could help that would be great!
Thanks
...
Particularly for PHP and Linux server admin.
...
I am learning regex. I have a very simple question:
I have a long string of content in php.I would like to convert all places where it says:
http://www.example.com/en/rest-of-url
to
http://en.example.com/rest-of-url
Could somebody help me with this? I think I use preg_replace for this?
Bonus: If you have a link to a good site whi...
I have input array as:
Input Array:
array
324545433 =>
array
0 =>
array
'Age' => int 0
'Status' => string 'INSTALLED/GOOD'
'Id' => string '830026495'
'name' => string 'TV'
1 =>
array
'Age' => int 0
'Status' => string 'INSTALLED/GOOD'
...
I don't know how to set up that the id field to print one by one per row in the script below which works wonders.
$tree = array();
$sql = "select * from products
left join product_varieties on product_varieties.product_id = products.id";
$sth = query($sql);
while($row = fetch($sth)) {
$id = $row['id'];
$tree[$id]['na...
Working in WordPress here. As you may know, all of the typical solutions for displaying upcoming events in WordPress are awful, so I'm accomplishing it with simple custom fields. Each event the user will enter they will enter a Numeric date "YYYYMMDD".
What I need to find out is how to code in PHP for the script to first get php:the...
If you have a class named "User" and another class named "Admin" that extends "User", and you want Admin to inherit all attributes,methods from User, except for the __construct method, for example.
class User {
private $name;
function __construct($name) {
$this->name = $name;
}
}
and
class Admin extends User {
private $authorization...
Basically I want to setup a tagging system like stack overflow has for entries and trying to plan out how a relevance based search would work. I want to have an option to pull up similar tagged entries for a related entries section. Right now I am using two tables for tags, a table for each unique tag and a join table. I am trying to thi...
I'm working on what is turning out to be a fairly complex SELECT query. I have several hierarchical queries being nested in a single SELECT and it is getting to be quite difficult to manage.
I'm running into a few places where my inline views need to be executed in more than one place, so it seems like a reasonable idea to execute thos...
I've written a very simple XML-RPC server application using Zend Framework 1.9, and it's running in an Apache 2 server on Windows. The application is in a virtual directory, defined with an "alias" directive.
My problem is that calls to the application from a client always seem to return a 301 error - "moved permanently", causing the cl...
Hi folks, I'm new to this so bear with my noobish question.
Basically I want a user to enter a search phrase into a web-form and for the query to be passed to the lastFM API and return top artists using that phrase based on their "gettopartists" API node. Here's the code I have...
function last($q){
$target_url='http://ws.audioscro...
I have two subsequent exec commands. The first executes without issue the second however is throwing an error:
exec('/usr/bin/pdftk A='. trim($original) .' cat A1 output '. trim($onepage), $output, $error);
var_dump($output); var_dump($error);
exec('/usr/bin/pdftk '. trim($onepage) .' background watermark.pdf output '. trim($modified)...
$value = '100.00';
echo $value * 100/100;
Or should I be rounding incase there's a value such as '100.70'? I'm displaying this for a table that displays daily rates, the total value contains the digits so I assume the user won't have to really worry about decimal values...
...