I have a file named “example.php”: I want to get every variable/array from “main.php” without knowing every variable/array name. Is it possible? get_defined_vars gives me every variable from the whole system so it’s not what I need. Answer Despite the comments correctly suggestin…
Tag: php
Custom Endpoint API based on attribute gutenberg block
Viewed 4 times 0 I need to return all posts that have the value of a specific attribute that is saved in the custom block attributes gutenberg. This value in the query will be according to the endpoint below. http://idinheiro.local/wp-json/idinheiro/v1/blocks-posts/id-here-attribute-gutenberg-block below my c…
AWS SQS only receiving 1 message from two different dispatch
Currently, I’m using the AWS PHP SDK to communicate with AWS SQS. I’m using a FIFO queue. We have different “models” that need to communicate with SQS, therefore they all have different message group ids in order to make SQS more efficient in processing the data. I’ve made a meth…
ACF pro – frontend form and WordPress categories while creating post
I try to build page where user can fill the form (using my custom ACF PRO fields) and save it as a post. Then admin need to check it and publish if everything is OK. So far I have form based on custom post type and ACF fields work good so far. But I need to display checkboxes with native
How to properly call openssl_decrypt method if I have base64 string which contains from IV and encrypted data?
I have code in C# which encrypts and decrypts string: If you check Decrypt(byte[] buffer), I take first 16 bytes which is IV. Now I similar want to implement in PHP (imagine, that I will encode on C# side and send it to server which runs on php, where I want to decrypt it back). As the param to my
mb_strlen() counts new lines twice – difference to .length() in JavaScript
I have this issue since we try to count the characters in a textarea field by JavaScript and to validate the character count with PHP. The problem appears when in the textarea a text is filled in with newlines. For counting in JavaScript we use without an changes of the input text (white spaces removing for e…
PHP: Get timestamp from date format YYYY-MM-DD HH:MM:SS GMT+HH:MM
I’m reading lines from a *.txt file and get strings (date formats) in this style: With the function DateTime::createFromFormat, I want to convert such lines into a time string. After that, I would like to get the timestamp with getTimestamp();. So, currently my code looks like this ($date is my read lin…
I can’t add a column to a table with data in laravel
I’m doing this: create: Code: The migration runs without problems, but I am going to check the table and the column is not added, if I create a new migration and put a total to the new column, it says that the column already exists, what error is occurring? Answer go to the database table and delete the…
Problem making previous next posts with php
I searched everywhere and found out you can use “–” before and “++” after a variable to substract or increase it by 1, but it just wont work properly, here’s my code Answer You can read more on increment and decrement operators. It basically does not applies to what you wan…
Using a php array as argument to a JavaScript function
I’ve a function which feeds a chart with fixed data: I’d like to replace the fixed data with the one read from a DB table containing two columns: date and temperature. The read data is stored in the $json variable: Here’s my bad code: How can I make this work? EDIT: Code after being edited w…