In PHP, how is variable scope handled in switch statements?
For instance, take this hypothetical example:
$someVariable = 0;
switch($something) {
case 1:
$someVariable = 1;
break;
case 2:
$someVariable = 2;
break;
}
echo $someVariable;
Would this print 0 or 1/2?
...
I change the language in my site using PHP arrays and lang?=. When the user clicks a link to change the language of the site I want this link to keep "pressed" or change to a different color, so the user knows in which version of the site he/she is. How can I activate a CSS property in this situation?
common.php:
<?php
session...
Hello there...
I cant seem to figure out how to create a flexible sidebar containing and login form (Zend_Form) and various module/controller specific links.
The most common solution seems to be using:
echo $this->action('login', 'authentication', 'default');
But apperently this isnt the 'best' way? I've read that this apprently tri...
I want to get the date for current date in php. what i tried is here...
echo $x."<br>";
echo date("D",$x)."<br>";
But the output was
21-02-10
Thu
It is giving correct date but not the correct day value.Why..?
What I want day is the date for monday for the current week which can be generated on any day of the week. so what I did w...
When accessing member that doesn't
exist, automatically creates the
object.
$obj = new ClassName();
$newObject = $ojb->nothisobject;
Is it possible?
...
I develop some PHP project on Linux platform. Are there any disadvantages of putting several thousand images (files) in one directory? This is closed set which won't grow. The alternative would be to separate this files using directory structure based on some ID (this way there would be let's say only 100 in one directory).
I ask this q...
I get this:
Warning: session_start(): Cannot send
session cookie - headers already sent
by (output started at
/www/zxq.net/w/e/e/weedcl/htdocs/index.php:3)
in
/www/zxq.net/w/e/e/weedcl/htdocs/common.php
on line 2 Warning: session_start():
Cannot send session cache limiter -
headers already sent (output started
at
...
I have created a simple WordPress plugin that automatically sets my new sites up with the default settings that are shared across all of them.
As part of the install, it creates my Privacy Policy page. However, currently, I'm just inserting "This is the privacy policy page" for the content, since it's just stored in a variable that I se...
I am an experienced programmer, and I have a few little ideas that I think would work really well as PHP based web applications. I have no problem with learning PHP, mySQL, etc, but I do have a problem with the design of a webpage in itself.
I am used to interface design ala Interface Builder and Swing, where there are some clearly defi...
$user->Phonenumbers[]->phonenumber = '123 123';
$user->Phonenumbers[]->phonenumber = '456 123';
$user->Phonenumbers[]->phonenumber = '123 777';
I've never seen this kind of syntax
EDIT
This seems more probably a feature,do you guys know how can I implement a feature like this?
...
The code works when I declare $lang like this (at the top of the index file):
index.php (with php variable declaration at the top):
<?php
$lang = 'es';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv...
I have a long log file I am displaying with PHP. Its getting too long for me and I have to use CTRL+F to look at this thing in any way. What is a good way to display this data in a way easy to read?
Best way would be using jquery.
...
I realise this is a bit vague but hoping someone might be able to point me in the right direction.
This is the error: Fatal error: Call to undefined function print_row() on line 418
Cause by this line:
**$something = profile_display_fields($css->id);**
In this code:
$customcss = get_records_select('user_info_field', '', 'sortorder...
I'm currently building a site that gives a lot of sorting options to the user and I want to build it in a way that it can be scaled without too much headache. Of course there are tradeoffs to both of these techniques, but id like to hear your opinions.
1) Store a serialized json array in a single column. When a new entry is added or re...
I want to be able to do something like this:
$table_object->getRows()->where($wer)->or($or)->orderBy('field', 'DESC');
If i were sure that all the methods will be called each time and in that order, then it would be simple and i can return an instance of the object itself on each method call so that the query gets build and finally ex...
Hi,
I'm editing the .htaccess file in order to make some overwrites to my php.ini file (I don't have access to it). So far, I've added:
php_value max_execution_time 600
php_value error_reporting E_WARNING
php_value log_errors Off
The application I'm editing for (vTiger CRM) recommends that "error_reporting" is set to "E_WARNING & ~E_...
class a
{
function __get($property){...}
}
$obj = new a();
var_dump(isset($obj->newproperty));
Seems the answer is nope but why?
...
Hey SO,
I've got a PHP/Mysql app that lets users post text from a form. When I insert text from an HTML textarea into my mysql table, it's not keeping the carriage returns/line breaks. The text is not stored in the DB as "Hey SO, \n This is a new line". It's stored with white space in the column (exactly like it's typed), but there is ...
in my class i have some properties. i want some values of these to have another property. but i noticed it wasnt possible.
code:
$property = "my name is: $this->name";
generated an error.
i set the $this->name with the constructor.
could you somehow accomplish this? i would like the "my name is: " to be defined in the property and ...
For example lets say I have a set of classes and methods to do so:
$obj->method1()->method2();
Is there anyway for method1() to know with in itself that its the first method being called or for method2 to know that its the last?
Some more details
I just want to be able to build a set of these calls so that it either returns an instan...