Access array element from function call in php
function array_test() { return array(0, 1, 2); } echo array_test()[0]; Can anyone explain why this code doesn't work? ...
function array_test() { return array(0, 1, 2); } echo array_test()[0]; Can anyone explain why this code doesn't work? ...
Hi, I need to convert a JS function to PHP Here is JS function function urlDecode(str){ str=str.replace(new RegExp('\\+','g'),' '); return unescape(str); } Thanks Riz ...
Hi, I am in the works of setting up a Trac server for my (small) company and need a bit of help/guidance with the authentication mechanism. We have for some time developed our own web application which our users access in their day to day work. It is build in php5.3 and includes a users database stored in a mysql database. I have been ...
Hi, So I have a users controller with an action called "selfView" it looks like this: (*users_controller.php*) function selfView() { $user = $this->User->find('first', array('conditions' => array('User.id' => $this->Auth->user('id')))); $formms = $this->Form->find('all', array('fields' => array('Form.id', 'Form.name'), 'recursive' ...
Hello all, I am trying to set up Digest Auth on shared server. I am using the script found here. Works on my home set up but when i use it on the host i get the error... Notice: HTTP Digest headers not being passed to PHP by the server, unable to authenticate user in <filename> Last time encountered this with another host they said ...
I'm trying to write a regular expression using the PCRE library in PHP. I need a regex to match only &, > and < chars that exist within string part of any XML node and not the tag declaration themselves. Input XML: <pnode> <cnode>This string contains > and < and & chars.</cnode> </pnode> The idea is to to a search and replace thes...
http://localhost/frontend_dev.php/1 Why is the above request redirected to frontend_dev.php instead of index.php? I've read the .htaccess: <IfModule mod_rewrite.c> RewriteEngine On # uncomment the following line, if you are having trouble # getting no_script_name to work #RewriteBase / # we skip all files with .something ...
How does one enable (or perhaps I need to install) GD when my phpinfo() output in "Configure Command" says; --without-gd ? I also have nothing in my phpinfo() output "Core" that lists "gd" PHP Version 5.2.4 on AWS. Thanks! ...
How can I turn this array: print_r($arr) Array ( [131] => stdClass Object ( [tid] => 131 [vid] => 9 [name] => apple [description] => [weight] => 0 ) [112] => stdClass Object ( [tid] => 112 [vid] => 9 [name] ...
Using the profile module I've created a textfield called profile_real_name which the user fills out when registering. How do I access this variable in the node.tpl.php? I used the dsm($user) function to output the user variables and it contained everything except the data for the profile_real_name I also ran dsm($vars) on the phptempl...
I already installed MAMP in my macbook pro. I want to run a php. what can i do? ...
Hey developers, I am trying to create an image gallery, such as when you click an image in Getty Images http://www.gettyimages.com/Search/Search.aspx?EventId=96396247&EditorialProduct=Sport Image: http://tinypic.com/r/efffvs/6 I am just looking to get a next and previous for the gallery. Also that the details underneath are chang...
On a text input, this is how you would "remember" the value the user entered if the form gets submitted to itself, for say a picture upload tool which requires that, so the user wont have to type everything into the form again after uploading a picture. <input type="text" id="text" name="text" value="<?php echo @$_POST['text'];?>"> ...
Considering that: The isset() construct returns TRUE if a variable is set and not NULL The is_null() function throws a warning if the variable is not set Is there a way to test whether a variable exists, no matter it's NULL or not, without using the @ operator to suppress the notice? EDIT Together with your first replies, I've be...
I have a strange problem in php MySQL: php connects with 127.0.0.1 but not with localhost. How to solve this issue? ...
I have created a build.xml file for phing to create code coverage reports. It uses phpunit codecoverage="true" and is pointed to the same file(s) as done with phpunit --coverage-html. The result differ, however. With phing I have 100% code coverage for all files, which I have not. There is probably something I don't know about running...
Hi, I currently have a jQuery/ajax request which produces a recordset which appears in #contentDiv on my page. The user can then browse the results and view further details of an item. Once on the page for the item it the user hits back on their browser they return to the default page for my search without their generated search resul...
Good afternoon. I am a user experience designer, proficient in XHTML and CSS. I have dabbled with some PHP and JavaScript but by no means am I comfortable with them. My main goal is to develop OS X and iPhone software. I have been given advice on those topics, but in I am struggling with Object Oriented programming. Books that I have ...
See the following example (PHP) class Parent { protected $_property; protected $_anotherP; public function __construct($var) { $this->_property = $var; $this->someMethod(); #Sets $_anotherP } protected function someMethod() ... } class Child extends Parent { protected $parent; public function __construct(...
As I continue to build more and more websites and web applications I am often asked to store user's passwords in a way that they can be retrieved if/when the user has an issue (either to email a forgotten password link, walk them through over the phone, etc.) When I can I fight bitterly against this practice and I do a lot of ‘extra’ pr...