<?php $data = '[{"ID":72,"post_author":"1","post_date":"2021-10-13 21:41:03","post_date_gmt":"2021-10-13 21:41:03","post_content":"<!-- wp:paragraph -->\n<p>test 123<\/p>\n<!-- \/wp:paragraph -->","post_title":"Test 123","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"test-123","to_ping":"","pinged":"","post_modified":"2021-10-13 21:42:39","post_modified_gmt":"2021-10-13 21:42:39","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10053\/?p=72","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":57,"post_author":"1","post_date":"2021-08-18 22:36:24","post_date_gmt":"2021-08-18 22:36:24","post_content":"<!-- wp:heading -->\n<h2>this is a nullam post<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>hier wird einganzganzganzganz langer text ver<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>with some image<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:image {\"id\":55,\"sizeSlug\":\"large\",\"linkDestination\":\"none\"} -->\n<figure class=\"wp-block-image size-large\"><img src=\"http:\/\/localhost:10053\/wp-content\/uploads\/2021\/08\/iljphp8-___-just-another-wordpress-site-364x1024.png\" alt=\"dolor sit amet\" class=\"wp-image-55\"\/><\/figure>\n<!-- \/wp:image -->","post_title":"Test123","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"57-2","to_ping":"","pinged":"","post_modified":"2021-10-13 21:34:02","post_modified_gmt":"2021-10-13 21:34:02","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10053\/?p=57","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":58,"post_author":"1","post_date":"2021-08-18 22:36:02","post_date_gmt":"2021-08-18 22:36:02","post_content":"<!-- wp:paragraph -->\n<p>hello worldies ihr da draussen.<\/p>\n<!-- \/wp:paragraph -->","post_title":"Test post","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"test-post","to_ping":"","pinged":"","post_modified":"2021-09-13 19:37:57","post_modified_gmt":"2021-09-13 19:37:57","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10053\/?p=58","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":42,"post_author":"1","post_date":"2021-08-13 23:22:10","post_date_gmt":"2021-08-13 23:22:10","post_content":"<!-- wp:cgb\/block-ilj-blocks {\"items\":[{\"title\":\"asdkfljsk\",\"description\":\"dsafsdaklj\"},{\"title\":\"dksljfsldkfj\",\"description\":\"dlskfjslkj\"},{\"title\":\"sldfjsdlkfj\",\"description\":\"alsdkfj\"}]} -->\n<p class=\"wp-block-cgb-block-ilj-blocks\"><\/p>\n<!-- \/wp:cgb\/block-ilj-blocks -->","post_title":"","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"42-2","to_ping":"","pinged":"","post_modified":"2021-08-29 23:13:42","post_modified_gmt":"2021-08-29 23:13:42","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10053\/?p=42","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":26,"post_author":"1","post_date":"2021-07-29 20:42:11","post_date_gmt":"2021-07-29 20:42:11","post_content":"","post_title":"pretium","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"pretium","to_ping":"","pinged":"","post_modified":"2021-08-02 17:23:16","post_modified_gmt":"2021-08-02 17:23:16","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=26","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":24,"post_author":"1","post_date":"2021-07-29 20:35:14","post_date_gmt":"2021-07-29 20:35:14","post_content":"","post_title":"Nullam","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"nullam","to_ping":"","pinged":"","post_modified":"2021-09-14 15:03:51","post_modified_gmt":"2021-09-14 15:03:51","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=24","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":22,"post_author":"1","post_date":"2021-07-29 20:34:40","post_date_gmt":"2021-07-29 20:34:40","post_content":"","post_title":"justo","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"justo","to_ping":"","pinged":"","post_modified":"2021-07-29 20:34:42","post_modified_gmt":"2021-07-29 20:34:42","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=22","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":20,"post_author":"1","post_date":"2021-07-29 20:34:16","post_date_gmt":"2021-07-29 20:34:16","post_content":"","post_title":"venenatis","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"venenatis","to_ping":"","pinged":"","post_modified":"2021-08-01 17:40:04","post_modified_gmt":"2021-08-01 17:40:04","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=20","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":18,"post_author":"1","post_date":"2021-07-29 20:33:49","post_date_gmt":"2021-07-29 20:33:49","post_content":"","post_title":"imperdiet","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"imperdiet","to_ping":"","pinged":"","post_modified":"2021-07-29 20:33:52","post_modified_gmt":"2021-07-29 20:33:52","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=18","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":14,"post_author":"1","post_date":"2021-07-15 22:37:15","post_date_gmt":"2021-07-15 22:37:15","post_content":"","post_title":"amet","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"amet","to_ping":"","pinged":"","post_modified":"2021-09-14 15:03:49","post_modified_gmt":"2021-09-14 15:03:49","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=14","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":12,"post_author":"1","post_date":"2021-07-15 22:36:53","post_date_gmt":"2021-07-15 22:36:53","post_content":"","post_title":"Dolor","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"dolor","to_ping":"","pinged":"","post_modified":"2021-08-01 17:48:28","post_modified_gmt":"2021-08-01 17:48:28","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=12","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":10,"post_author":"1","post_date":"2021-07-15 22:36:32","post_date_gmt":"2021-07-15 22:36:32","post_content":"","post_title":"ipsum","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"ipsum","to_ping":"","pinged":"","post_modified":"2021-08-01 17:48:44","post_modified_gmt":"2021-08-01 17:48:44","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=10","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":8,"post_author":"1","post_date":"2021-07-15 22:36:07","post_date_gmt":"2021-07-15 22:36:07","post_content":"","post_title":"Lorem","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"lorem","to_ping":"","pinged":"","post_modified":"2021-10-13 21:41:55","post_modified_gmt":"2021-10-13 21:41:55","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=8","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":6,"post_author":"1","post_date":"2021-07-15 22:35:28","post_date_gmt":"2021-07-15 22:35:28","post_content":"<!-- wp:paragraph -->\n<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. ***** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus.<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut<\/p>\n<!-- \/wp:paragraph -->","post_title":"My Lorem Ipsum","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"my-lorem-ipsum","to_ping":"","pinged":"","post_modified":"2021-08-29 23:03:32","post_modified_gmt":"2021-08-29 23:03:32","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=6","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":1,"post_author":"1","post_date":"2021-07-15 22:27:37","post_date_gmt":"2021-07-15 22:27:37","post_content":"<!-- wp:paragraph -->\n<p>Welcome to WordPress. This is your first post. Edit or delete it, then start writing!<\/p>\n<!-- \/wp:paragraph -->","post_title":"Hello world!","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"open","post_password":"","post_name":"hello-world","to_ping":"","pinged":"","post_modified":"2021-08-18 22:37:50","post_modified_gmt":"2021-08-18 22:37:50","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?p=1","menu_order":0,"post_type":"post","post_mime_type":"","comment_count":"1","filter":"raw"},{"ID":2,"post_author":"1","post_date":"2021-07-15 22:27:37","post_date_gmt":"2021-07-15 22:27:37","post_content":"<!-- wp:paragraph -->\n<p>This is an example page. Its different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>Hi there! Im a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin caught in the rain.)<\/p><\/blockquote>\n<!-- \/wp:quote -->\n\n<!-- wp:paragraph -->\n<p>...or something like this:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><p>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.<\/p><\/blockquote>\n<!-- \/wp:quote -->\n\n<!-- wp:paragraph -->\n<p>As a new WordPress user, you should go to <a href=\"http:\/\/localhost:10044\/wp-admin\/\">your dashboard<\/a> to delete this page and create new pages for your content. Have fun!<\/p>\n<!-- \/wp:paragraph -->","post_title":"Sample Page","post_excerpt":"","post_status":"publish","comment_status":"closed","ping_status":"open","post_password":"","post_name":"sample-page","to_ping":"","pinged":"","post_modified":"2021-07-15 22:27:37","post_modified_gmt":"2021-07-15 22:27:37","post_content_filtered":"","post_parent":0,"guid":"http:\/\/localhost:10044\/?page_id=2","menu_order":0,"post_type":"page","post_mime_type":"","comment_count":"0","filter":"raw"}]'; $obj = json_decode($data); echo json_encode($obj[0]->{'post_content'}); ?>
Write, Run & Share PHP code online using OneCompiler's PHP online compiler for free. It's one of the robust, feature-rich online compilers for PHP language, running on the latest version 7. Getting started with the OneCompiler's PHP compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as PHP
and start coding.
OneCompiler's PHP online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample PHP program which takes name as input and prints hello message with your name.
<?php
fscanf(STDIN, "%s\n", $name);
echo "Hello ".$name.".\n";
?>
PHP(Hypertext Preprocessor) is widely used server sripting language by Rasmus Lerdorf in the year 1994.
In PHP, there is no need to explicitly declare variables to reserve memory space. When you assign a value to a variable, declaration happens automatically. Variables are case-sensitive in PHP.
$variable_name = value;
If, If-else, Nested-Ifs are used when you want to perform a certain set of operations based on conditional expressions.
if(conditional-expression){
//code
}
if(conditional-expression){
//code if condition is true
} else {
//code if condition is false
}
if(condition-expression1) {
//code if above condition is true
} elseif(condition-expression2){
//code if above condition is true
}
elseif(condition-expression3) {
//code if above condition is true
}
...
else {
//code if all the conditions are false
}
Switch is used to execute one set of statement from multiple conditions.
switch(conditional-expression) {
case value1:
// code if the above value is matched
break; // optional
case value2:
// code if the above value is matched
break; // optional
...
default:
// code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
// code
}
// you can use any of the below syntax
foreach ($array as $element-value) {
//code
}
foreach ($array as $key => $element-value) {
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
function function_name(parameters) {
//code
}
function_name (parameters)