Skip to content

Tag: php

PHP – comparing 2 identical strings returns false

I have read some posts about this problem. Tried to use trim but it does not help. Php script sends a curl request to another server which returns ok if the request were successful. The script shows ok and stops to excecute – exits. Why ok is not ok for the script? var_dump($request); shows the followin…

expecting statement -php syntax | if-else

I get critical error.phpstorms says that expecting statements.I couldnt find a solution Answer You cannot “interrupt” the PHP code after the closing { of the if and before the else keyword. Cleaned up version: To avoid such errors, try learning and following a coding standard, e.g. PSR-12. Since y…

how to extract key and value from json content?

what I have tried is this. Can anyone help me in extracting keys and values like notificationType,bounceType,timestamp etc; It would be great help for me if anyone help me achieving this. Thank you. Answer json_decode decode a string converting it in php data structures: array or object. Check docs for json_d…

CI4 Inserting ID from selected Strings

I’m so tired of thinking how to solve this case. already search by internet and never solved. straight to the point this is my Controller of Product.php this is my Models Model_product.php and this is my Views create.php i want to insert new data from Controller Product function store. i’ve this p…

Xdebug not creating log files

Looking for some advice. Changed servers and I have setup Xdebug. PhpStorm detects it enabled, so does PHP, although I cannot get it to work. (Firewall port opened, my firewall disabled, settings all configured, but I am getting nothing) In order to identify the issue, I need to be able to see the Log of Xdeb…

Search an array for a key and output the value

I have a large array in PHP that has this snippet of data. Is there a way to search through an array and find the value of “date” without traversing through all the nodes? It should be noted that “date” in itself isn’t unique but $subscription->schedule_next_payment->date i…

Issue generating proper JSON array response

Essentially I have the following PHP script that generates a response based on output of the query, I need the JSON to in a different format with each response listed sequentially: <?php $stmt = $…