Skip to content

How to call view in another view by using cakephp

I am just new CakePhp, i wonder how to call a view in another view. When I started to run CakePhp the default layout is located in view/layouts/default.ctp. In default.ctp I called a view name …

Is it wrong to use a hash for a unique ID?

I want to use a unique ID generated by PHP in a database table that will likely never have more than 10,000 records. I don’t want the time of creation to be visible or use a purely numeric value so I am using: Is it wrong to use a hash for a unique ID? Don’t all hashes lead to collisions

Reading from STDIN pipe when using proc_open

I am trying to make a website where people can compile and run their code online, thus we need to find an interactive way for users to send instructions. Actually, what first comes to mind is exec() or system(), but when users want to input sth, this way won’t work. So we have to use proc_open(). For in…

Why does PHP compact() use strings instead of actual variables?

Can anyone explain the benefit of PHP’s compact() function accepting the string of ‘a variable with that name’ instead of the actual variable? For example: Why do I need to pass a string of the variable name instead of just passing the variable itself and PHP handling mapping this to an arra…

Get the first key in an associative array

I’m trying to get the first key of an array in an associative array like below. I know I can use key, but I read (on this site), that’s it’s less efficient. So I’m using current(array_keys($data)). …

Remove querystring value on page refresh

I am redirecting to a different page with Querystring, say I am able to display a message on the redirected page with the help of querystring value by using the following code, say But my problem is that the message keeps on displaying even on refreshing the page. Thus I want that the message should get remov…

Bind Param with array of parameters

I have a function that does this: Which sends off to my database class, which does this: The problem is this doesn’t work. What I was hoping to do, was to take the $params list and have it list them after the $type, so that the query would resemble: But obviously I’m going about it the wrong way. …

PHP XML serializer

Is there some php libraries which implement serialization of data to XML-format like serialize() and unserialize() (with restoring objects from XML) functions of objects with private and protected …