Questions tagged [php-5.4]

PHP 5.4 is the successor to PHP 5.3. It was released on March 1, 2012. Use this tag for version-specific issues relating to specifically to PHP 5.4.

PHP 5.4 Changes:

  • Support for traits has been added.
  • Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];.
  • Function array dereferencing has been added, e.g. foo()[0].
  • Closures now support $this.
  • <?= is now always available, regardless of the short_open_tag php.ini option.
  • Class member access on instantiation has been added, e.g. (new Foo)->bar().
  • Class::{expr}() syntax is now supported.
  • Binary number format has been added, e.g. 0b001001101.
  • Improved parse error messages and improved incompatible arguments warnings.
  • The session extension can now track the upload progress of files.
  • Built-in development web server in CLI mode.

See Migrating from PHP 5.3.x to PHP 5.4.x for more information.

Information

  • If you want to talk about PHP or if you have a question, you can come to Chat Room 11: PHP.
  • For global question on PHP, please use the generic tag:
402 questions
0
votes
2 answers

PHP class implementing Serializable doesn't serialize

What I was really looking for was a magic method __toArray for my class, but I guess such a thing doesn't exist, and the ArrayAccess interface doesn't match what I'm looking for. I would like to be able to return a json_encoded representation of my…
M Miller
  • 5,364
  • 9
  • 43
  • 65
0
votes
2 answers

PHP Chaining: how to get data from a mysql table?

I am trying to implement PHP chaining method in my web development project. But I seem can't get it right. class foo extends base{ public $query = null; public $item = array(); public function __construct($connection){ …
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
2 answers

How to return objects or arrays from a chaining interface in PHP OOP?

I am curious in writing a chaining interface in PHP OOP. I modified this sample code from the php.net website, and I want to take it further - how can I return objects or arrays from this kind of interface? // Declare a simple class class…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
1 answer

Read Excel file in array or get adyacent columns values with PHPExcel

I have a Excel file with content like the showed in the image: As you may see there is basically three columns (could be four or more) which represents categories and subcategories. I need to read this Excel file for then write some SQL sentences…
Reynier
  • 2,420
  • 11
  • 51
  • 91
0
votes
1 answer

preg_split but ignore XML and HTML entities

I using this php code to split a string roughly every 120 chars. It splits at the closest space. But it splits HTML and XML entities, so it sometimes outputs things like id="id">. How can I make it so it ignores XML and HTML entities, but does not…
rob
  • 13
  • 2
0
votes
1 answer

php: writing a curly parser

I found this idea of curly parser online and I want to further develop it. The original parser is made for passing youtube. class curly { /** * Replace the macros in an input string * @param string $input * @return string …
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
2 answers

PHP: How {{string}} into a php code

How do you turn a piece of {{string}} into a php code, for instance, {{secure_base_url}} to echo secure_base_url; I see this kind of method is used a lot in Magento. I wonder how do you do it if you are writing your own programme. Do I need some…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
1 answer

How to use recaptcha in login page of FOSUserBundle

I m working on a Symfony 2.2 project in which i m using the "FOSUserBundle" for security which works perfectly . I m also using "ewzrecaptchabundle" which is also working fine . my problem is that i want to use recaptcha in login page of…
Ajeet Varma
  • 726
  • 4
  • 20
0
votes
1 answer

PHP 5.4 traits - what is the point?

As far as I can tell PHP traits exist to offer pseudo multi-inheritance... and looking at them, they rather remind me of structs, except there return type is the same as functions. ANYWAY - what can I do with a trait that I can't already do with an…
aserwin
  • 1,040
  • 2
  • 16
  • 34
0
votes
2 answers
0
votes
1 answer

php inheritance: children classes to inherit the data in the parent class?

Sometimes I get lost and started to doubt whether I am doing right in writing classes in php. For instance, these are quite basic and simple classes, class base { protected $connection = null; /** * Set the contructor for receiving…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
0 answers

php 5.4 Compile Error: Call-time pass-by-reference has been removed in

I can't fix this, when i used this code on php 5.3 this run perfectly; i'm just using the functions of Symfnony and doctrine without references. $valoresDefecto = array(); foreach($cambios as $cambio) { …
0
votes
1 answer

Unable to load config file in smarty

I'm new to PHP and smarty, I don't know how to solve this. This is a rough idea about my project directory MyProject ->include ->configs->site.conf MyProject ->include->config.php MyProject ->libs->smarty->plugins MyProject…
Kapil
  • 1
  • 1
  • 4
0
votes
2 answers

How to access a var with "-" in PHP

For first time I found this problem, see I've a array of objetcs and I access them as follow: $arrayOfObjects[$pos]->value; But my problem is that one of the array values have a "-" meaning the value is e-mail so when I do…
Reynier
  • 2,420
  • 11
  • 51
  • 91
0
votes
0 answers

jquery ajax not inserting data in mysql table

I am new to jquery-ajax. My payment_gateway_1.php is: