Skip to content

Tag: php

How to convert Hex to binary in PHP?

I’m trying to send 0x01 HEX as Byte using the socket_write($socket, XXXX , 1); function. There is part of documentation: “…If yes, server will reply to module 0x01, if not – replay 0x00. Server must send answer – 1 Byte in HEX format.” Answer There are multiple alternatives: When using…

Split string into 2 letters

I am trying to split a string into 1, 2 and 3 segments. For example, i currently have this: Which works well on 1 character splitting, I get: However when I try: I get: Is there a way so that I can output this? : and then also with 3 characters like this? Answer Here it is: PHPFiddle Link: http://phpfiddle.or…

zf2 change language dynamically

I have one question, about ZF2 Translator, in the specific case in the costruction the link for change langauge dunamically when user click on flag or menu link. In My Application/config/module.config.php i have this code: and my route is: And in my Application/Module.php i set this code on bootstrap: now my …

How to add PHP pagination in array’s

I’ve been trying a lot of ways to add PHP pagination. I have tried searching and trying to figure other ways of implementing the pagination but none of them work. Here’s how I created the Index page: I would like to know how I can paginate the the array list. Thanks! Answer u can use simple PHP fu…

Pico CMS custom header

Im trying to include dynamc custom header in PicoCMS. Simple “include ‘header.php’;” wont work since the theme have only index.html file and and I cant include PHP in it. My guess is I would have to make a custom plugin for this to work but Im not shure how to do it. They have some doc…

mysqli_fetch_array returning only one result

I’m trying to make a very, very simple query of a small mysql database, using the following code (with appropriate values in $host, etc.): As you can see, I printed out the results in a human-readable way, yielding: There are a few example universities in that column, so I’m not sure what I’…